我的服务器工作正常,但有些事情发生了变化,我不确定是什么。
我收到以下错误,无法获取某些子域名。
apache2: Could not reliably determine the server's fully qualified domain name, using 2001:.....:a669 for ServerName
[Sat Dec 14 21:20:36 2013] [warn] NameVirtualHost 0.0.0.0:80 has no VirtualHosts
...
[Sat Dec 14 21:20:36 2013] [warn] NameVirtualHost 0.0.0.0:80 has no VirtualHosts
Syntax OK
我尝试将ports.conf更改为Listen 80和Listen 0.0.0.0:80(参见http://www.rackaid.com/resources/how-to-disable-ipv6-in-apache-server/)
这是我的一个vhost文件。
NameVirtualHost 0.0.0.0:80
Listen 0.0.0.0:80
<VirtualHost 0.0.0.0:80>
ServerName www.domain.us
ServerAlias domain.us
ServerAdmin email@domain.us
DocumentRoot /home/valid_domain_path/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/valid_domain_path/www>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/www.domain.us.error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel info
CustomLog ${APACHE_LOG_DIR}/www.domain.us.access.log combined
000-default正确链接。
Apache 2.2.22
谢谢,
答案 0 :(得分:10)
如果我的怀疑是正确的,并且您的系统最近已经更新,那么您现在使用的是Apache 2.4而不是2.2,就像许多其他用户刚刚(已)转移到新的Ubuntu 13.10版本一样。 (如果您尚未更改为Apache 2.4,那么现在可能是更新新的* .conf文件的好时机。)
以下是关于如何使基于命名的VirtualHosts在Apache 2.4中运行的非常好的解释: http://httpd.apache.org/docs/2.4/vhosts/name-based.html
本质上:
<VirtualHost *:80>
ServerName www.example.com
最后它应该是这样的:
<VirtualHost *:80>
# This first-listed virtual host is also the default for *:80
ServerName www.example.com
ServerAlias example.com
DocumentRoot /www/domain
</VirtualHost>
<VirtualHost *:80>
ServerName other.example.com
DocumentRoot /www/otherdomain
</VirtualHost>