Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to setup my virtual server to host websites based on IP. Currently I am trying to only setup 1 website and using only 1 IP.

/etc/httpd/conf.d/ file contents:

Listen 80

    DocumentRoot /var/www/sites/
    ErrorLog /var/log/httpd/
    CustomLog /var/log/httpd/ combined

I removed "Listen" and "NameVirtualHost" from httpd.conf and only using them in my files.

The problem that I'm having is that the apache test page kicks in and not the website but once I change the IP to "*" it works:

<VirtualHost *:80>
    DocumentRoot /var/www/sites/
    ErrorLog /var/log/httpd/
    CustomLog /var/log/httpd/ combined

Any ideas why is this happening?

UPDATE!! The IP address that I am trying to use is not an internal network IP but an external (public) IP address. I have 3 public IP addresses pointing to this server.

Thanks, Alex

share|improve this question
What happens if you put listen ipaddr:80 into the config and restart with the vhost config being an IP address? – qweet Jul 11 '12 at 12:52
I tried putting in Listen for that IP address but after that it will fail to restart apache, error: (99)Cannot assign requested address: make_sock: could not bind to address no listening sockets available, shutting down – Alex Jul 11 '12 at 13:29
Since you mentioned it, do you have internal network IPs? If you have something changing the IP address on the packet before it gets to your server, then apache won't know what the "public" IP address was, it will only see the internal IP. – DerfK Jul 11 '12 at 14:02
Is this public IP address configured directly at your server? – Alex Jul 11 '12 at 14:17
Hi, I contacted the hosting provider and it is as @DerfK thought that the IP is just pointing (nat'd) to the server but the server doesn't know about it. They told us to use the internal virtual server IP and not the public IP. Thanks guys this is now resolved. – Alex Jul 11 '12 at 15:17
up vote 4 down vote accepted

Since you have a firewall or some other device changing the IP on the packet from a public IP to a private IP, you will need to use the private IP in Apache's configuration for the VirtualHost. Apache will only see the private IP, so it won't know what public IP was originally requested.

share|improve this answer

Do you still have the welcome.conf that CentOS puts in the Apache conf directory?

There's no need for it once you start customising your Apache configuration and it acts as a default catch-all vhost.

share|improve this answer
Hi @Ladadada I tried removing the welcome.conf but all that does is showing the root of directory /var/www/sites that contains the folder – Alex Jul 11 '12 at 13:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.