I'm trying to setup an Apache server with several virtual hosts (www.domain.com & store.domain.com), but for some reason, when I just have one of them enabled (store.domain.com) Apache redirects to the wrong document root (/var/www), which is apparently the default one. This is the virtual host configuration file for the one that's not redirecting correctly:
<VirtualHost *:80> ServerName store.domain.com ServerAdmin [email protected] DocumentRoot /var/www/store/public_html/ ErrorLog /var/www/store/logs/error.log CustomLog /var/www/store/logs/access.log combined </VirtualHost> When I run the command apache2ctl -S I get the following:
Name or service not known: AH00547: Could not resolve host name *80 --ignoring! AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using xxx.xxx.xxx.xxx. Set the 'ServerName' directive globally to suppress this message VirtualHost configuration: ServerRoot: "/etc/apache2" Main DocumentRoot: "/var/www" Main ErrorLog: "/var/log/apache2/error.log Mutex watchdog-callback: using_defaults Mutex rewrite-map: using_defaults Mutex ssl-stapling: using_defaults Mutex ssl-cache: using_defaults Mutex default: dir="/var/lock/apache2" mechanism=fcntl Mutex mpm-accept: using_defaults PidFile: "/var/run/apache2/apache2.pid" Define: DUMP_VHOSTS Define: DUMP_RUN_CFG .... Looks like the key is on the first line of the previous error, but I can't figure out what's wrong.
When I have the following virtual host enabled, it works fine:
<VirtualHost *:80> ServerAdmin [email protected] ServerName www.domain.com DocumentRoot /var/www/html/www/public_html/ ErrorLog /var/www/html/www/logs/error.log CustomLog /var/www/html/www/logs/access.log combined </VirtualHost> When this last virtual host is enabled, store.domain.com redirects to www.domain.com
Any suggestions? Please let me know if you need any additional information.
apache2ctl configtest.listen.conffile for possible syntax error.