mod_unique_id: unable to find IPv4 address of FQDN despite setting etc/hosts and Apache ServerName
Solution 1
The problem was SELinux
#less /var/log/audit/audit.log
type=AVC msg=audit(1311546944.235:1040): avc: denied { read } for pid=1396 comm="httpd"
name="hosts" dev=dm-0 ino=262931
scontext=user_u:system_r:httpd_t:s0
tcontext=system_u:object_r:initrc_tmp_t:s0 tclass=file
In my case the following solved it:
# ls -lZ /etc/hosts
-rw-r--r-- root root system_u:object_r:initrc_tmp_t /etc/hosts
# setenforce 0
# restorecon -R -F -v /etc/hosts
# setenforce 1
# ls -lZ /etc/hosts
-rw-r--r-- root root system_u:object_r:etc_t /etc/hosts
Solution 2
I'd be looking for typos and other "stupidly simple" mistakes we all make from time to time (I use my wife as a proof-reader), but if that doesn't work I'd just fire up strace to see what mod_security
is trying to do. It might not be reading /etc/hosts
-- perhaps it's taking a failure to resolve the name via DNS as some sort of hard failure instead, or something else.
At any rate, I'd be putting the machine's name in DNS anyway. It just saves so many hassles.
Related videos on Youtube
user1010101
Updated on September 18, 2022Comments
-
user1010101 over 1 year
I would like to work on a ruby on rails project with a group of 4 people. If we install rails 4.2.0 how can we ensure that we all share the same environment? Is the only option to have install VM? or is there some other way? I mean what if one user is using mac another is on windows and another is on Linux? How can we ensure all are having same environment so there is no configuration issues etc? What is the easiest solution?
-
Marc Baumbach about 9 yearsYou'll have to be more specific, I think. Do you just mean the same database, or do you have external dependencies? Usually making sure you use a SCM tool and Bundler correctly, you should all have the same environment. If your concern is more OS, then a VM like Vagrant or Docker may be your best choice.
-
-
KCD almost 13 yearsYes I've been struggling to rule out problems existing between the keyboard and the chair. Asking our hosting provider to add the computer name to the DNS would help but it would be nice to know why apache doesn't seem to process the hosts file
-
KCD almost 13 yearsAwarded this as the solution because strace identified the true problem and a DNS entry would've solved it either way
-
womble almost 13 yearsIt'd be worth putting the reason you found in as an answer, for future searchers who come across your question and would like to know exactly what the answer was. I'm curious too, now.
-
KCD almost 13 yearsI'm one step ahead of you, see the third section added to the question. SELinux was the problem, I'll edit it to make it clearer. Thanks again for your help!
-
womble almost 13 yearsI'm saying make it an answer, not part of your question -- self-answering is explicitly encouraged, as not everyone who finds the question will read the whole question, they'll skim just enough to see that it fits their problem and then skip straight to the answers.
-
KCD almost 13 yearsFair enough. Only reason I didn't do that is so I could credit you with the answer :)
-
womble almost 13 yearsI'm wonderfully selfless... although you don't have to take away my precioussssssss accepted tick. <grin>
-
KCD almost 13 yearsHa indeed, chances are you'll answer my next question anyway (note to self - learn about StackExchange 'Chat')
-
user1010101 about 9 yearsIs there some free solution available ?
-
Amit Joki about 9 years@Learner afaik, I don't know of any free solution to this.
-
Antarr Byrd about 9 years@Learner I haven't used it but you may want to look at Runnable
-
user1010101 about 9 yearsOne of my group member is insisting we all download VM so we have identical vdi image or else it will be an issue. I am new to rails so i wanted to make sure if this is the case.