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'm having a little trouble configuring name based Virtual Hosts.

I can start the server with "service apache2 start" with a blank httpd.conf file, and it will run with everything pointing to /var/www, as expected.

When I fill httpd.conf with:

# Ensure that Apache listens on port 80
Listen 80

# Listen for virtual host requests on all IP addresses
NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot /www/kevins_playground

# Other directives here


<VirtualHost *:80>
DocumentRoot /www/flatline_and_co

# Other directives here


I get this error when running "service apache2 start"

root@kevin-server:/etc/apache2# service apache2 start
 * Starting web server apache2
apache2: Could not reliably determine the server's fully qualified domain name, using for ServerName
[Thu Jul 26 20:10:01 2012] [warn] NameVirtualHost *:80 has no VirtualHosts
(98)Address already in use: make_sock: could not bind to address
no listening sockets available, shutting down
Unable to open logs
Action 'start' failed.
The Apache error log may have more information.

I found a solution,

  1. I removed all my changes to httpd.conf, for me, this left a blank file.
  2. I copied the existing default site file in ./sites-available/ for my two Virtual Hosts.
  3. I edited those two files and replaced values where it made sense, I think it should be obvious where they need changing (Website base folder, Website URL).
  4. I created sym-links like you are supposed to in ./sites-enabled/
  5. I restarted the web-server 'sudo service apache2 restart' and it worked.

I think the problem stemmed from the fact that while parsing the files, Apache discovered two files with "<VirtualHost>"s, my httpd.conf and the default website configuration in ./sites-available/

share|improve this question

migrated from Jul 27 '12 at 10:29

This question came from our site for professional and enthusiast programmers.

Does netstat -anp | grep 80 show any other processes currently bound to – sarnold Jul 27 '12 at 0:48
Just this: unix 3 [ ] STREAM CONNECTED 9050 1080/console-kit-da – Kevin Johnson Jul 27 '12 at 0:52
Okay, good; that's unrelated. (It's a Unix domain socket, not a a TCP socket.) – sarnold Jul 27 '12 at 1:01
Perhaps the problem is in those other directives. – n.m. Jul 27 '12 at 1:05
oh no, sorry to confuse you, that is an actual comment, the configuration was taken directly from Just modified for my situation – Kevin Johnson Jul 27 '12 at 1:09
up vote 1 down vote accepted

As long as you did not touch the default vhost (which already contains a NameVirtualHost *:80 directive), you should not duplicate the default behaviour.

Since you have to suffer Debuntu, why not go with it and put your vhosts in /etc/apache2/sites-enabled/, one per file ?

share|improve this answer
Thats what I did, in the end. See the edit to my question. – Kevin Johnson Jul 27 '12 at 19:02

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.