I'm trying to configure Apache as an in-network webserver, and am using the sites-available/sites-enabled feature as opposed to just static vhost files. I set up a couple VirtualHosts, all with a unique DocumentRoot, however request for all the VirtualHosts just serve up the "It's Working!" default file. I can't for the life of me figure out why it won't serve the content out of the correct directory. Here's the contents of the virtualhost directive files, let me know if I need to post more.
default (note that apache renames this to
000-default in sites-enabled, so it's not an ordering issue)
NameVirtualHost *:80 ServerName emp <VirtualHost *:80> ServerAdmin webmaster@localhost ServerName emp DocumentRoot /var/www <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog /var/log/apache2/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/apache2/access.log combined Alias /doc/ "/usr/share/doc/" <Directory "/usr/share/doc/"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 </Directory> </VirtualHost>
<VirtualHost *:80> ServerName billmed.emp ServerRoot /home/empression/Projects/billmed/web/httpdocs <Directory "/home/empression/Projects/billmed/web/httpdocs"> Order Allow,Deny Allow from All </Directory> </VirtualHost>
Note that I have DNS zones for both
billmed.emp, as well as entries in /etc/hosts. My ultimate goal is to set up this machine as an in-house webserver with a custom tld (emp), but progress has been pretty slow.
Some more info
#custom-sites 192.168.1.100 emp 192.168.1.100 billmed.emp
# If you just change the port or add more ports here, you will likely also # have to change the VirtualHost statement in # /etc/apache2/sites-enabled/000-default # This is also true if you have upgraded from before 2.2.9-3 (i.e. from # Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and # README.Debian.gz #NameVirtualHost *:80 Listen 80 <IfModule mod_ssl.c> # If you add NameVirtualHost *:443 here, you will also have to change # the VirtualHost statement in /etc/apache2/sites-available/default-ssl # to <VirtualHost *:443> # Server Name Indication for SSL named virtual hosts is currently not # supported by MSIE on Windows XP. Listen 443 </IfModule> <IfModule mod_gnutls.c> Listen 443 </IfModule>
ls -l sites-enabled
empression@empression-server1:/etc/apache2/sites-available$ ls -l ../sites-enabled/ total 0 lrwxrwxrwx 1 root root 26 2010-05-22 12:36 000-default -> ../sites-available/default lrwxrwxrwx 1 root root 26 2010-05-22 13:33 billmed -> ../sites-available/billmed
I wasn't able to work on this for a few weeks, but I have tried all the solutions posted below as of now, and am still unable to fix the problem so I have added a bounty.
Here's the output of
apache2ctl -t -D DUMP_VHOSTS
empression@empression-server1:~$ apache2ctl -t -D DUMP_VHOSTS apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName [Mon Jul 12 14:29:01 2010] [warn] NameVirtualHost 127.0.0.1:80 has no VirtualHosts VirtualHost configuration: 192.168.1.100:80 is a NameVirtualHost default server billmed.emp (/etc/apache2/sites-enabled/billmed:1) port 80 namevhost billmed.emp (/etc/apache2/sites-enabled/billmed:1) Syntax OK