I have a virtual machine running CentOS 6.4, and trying to setup an Apache server, but I cannot get to display the Apache test page.
I've installed it using yum install httpd
and checked that all my software is up-to-date.
I've then enabled name-based virtual hosting on port 80 by uncommenting the line NameVirtualHost *:80
in /etc/httpd/conf/httpd.conf
, and opened all incoming traffic in port 80:
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
/sbin/service iptables save
With all this setup, I then go into my browser in Windows and type the vitual machine's IP (192.168.1.XX), but the browser cannot connect to it.
On the other hand, when I run curl localhost
in my virtual machine, I do see the HTML of the test page, so it might be that, for some reason, the firewall is still blocking port 80.
No virtual hosts have been added yet, but, as far as I know, that's not necessary to display the Apache test page.
Edit:
When running netstat -ntlup
, it looks like httpd is running and has port 80 open:
[root@myhostname ~]# netstat -ntlup
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1167/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1243/master
tcp 0 0 :::80 :::* LISTEN 2245/httpd
tcp 0 0 :::22 :::* LISTEN 1167/sshd
tcp 0 0 ::1:25 :::* LISTEN 1243/master
udp 0 0 0.0.0.0:68 0.0.0.0:* 2087/dhclient
And the output of apachectl -S
is:
[root@myhostname ~]# apachectl -S
httpd: apr_sockaddr_info_get() failed for myhostname
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[Tue Sep 17 17:03:06 2013] [warn] NameVirtualHost *:80 has no VirtualHosts
VirtualHost configuration:
Syntax OK
If I add the line ServerName myhostname:80
to /etc/httpd/conf/httpd.conf
, then apachectl
can determine the server's name (see below), but I still get no output in the Windows browser.
[root@myhostname ~]# apachectl -S
[Tue Sep 17 17:27:09 2013] [warn] NameVirtualHost *:80 has no VirtualHosts
VirtualHost configuration:
Syntax OK
Any ideas on what might I be missing?
(I've moved this question here from stack overflow)
apachectl -S
to your question.