Reputation: 2894
I added the following text to httpd.conf at the bottom:
<VirtualHost 12.34.56.78.80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/some_dir/
ServerName foo-bar.example.com
ErrorLog /logs/foo-bar.example.com-error_log
CustomLog /logs/foo-bar.example.com-access_log common
</VirtualHost>
..and then when attemping to run the following command:
/etc/init.d/httpd restart
I get the following error:
[error] (EAI 2)Name or service not known: Could not resolve host name 12.34.56.78.80 -- ignoring!
Note that names and the ip address have been changed for this post.
Upvotes: 2
Views: 4986
Reputation: 84
It's a typo within your config.
Wrong: <VirtualHost 12.34.56.78.80>
Should be: <VirtualHost 12.34.56.78:80>
Upvotes: 2
Reputation: 10063
I had the same problem with CentOS server and spent like 1/2 day on investigation. Eventually got it fixed with 2 steps:
STEP 1
Make sure that firewall (iptables) doesn't block port 53. I added to
/etc/sysconfig/iptables
/etc/sysconfig/ip6tables
the following lines:
-I INPUT -p udp -m udp --dport 53 -j ACCEPT
-A OUTPUT -p udp -m udp --sport 53 -j ACCEPT
-I INPUT -p tcp -m tcp --dport 53 -j ACCEPT
-A OUTPUT -p tcp -m tcp --sport 53 -j ACCEPT
restarted firewall
# service iptables restart
and then restarted Apache
# service httpd restart
And then I got again:
[error] (EAI 2)Name or service not known: Cou...
I restarted Apache again and this time the hosts could be resolved but unfortunately the website still didn't work. So I tried restarting Apache several times and the above error occurred randomly!
STEP 2
Nothing worked so I finally restarted the whole server
# /sbin/reboot
and voilà everything started working like a charm!
Upvotes: 0