我试图设置一个Apache服务器与几个虚拟主机(www.domain.com&store.domain.com),但由于某种原因,当我刚刚启用它们之一(store.domain.com)Apacheredirect到错误的文档根目录(/ var / www),这显然是默认的。 这是没有正确redirect的虚拟主机configuration文件:
<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>
当我运行命令apache2ctl -S我得到以下内容:
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 ....
看起来关键是在前面的错误的第一行,但我不明白什么是错的。
当我有以下虚拟主机启用,它工作正常:
<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>
当最后一个虚拟主机启用时,store.domain.com将redirect到www.domain.com
有什么build议么? 请让我知道,如果你需要任何额外的信息。
Apache ServerAlias
尝试添加ServerAlias除了ServerName。
名称或服务未知:AH00547:无法parsing主机名* 80
检查你的configuration寻找*80 。