2008年10月26日星期日

directive requires additional arguments

当虚拟主机设置好以后,我重启时发现停成功了,启动失败了,有如下提示:

Starting httpd: Syntax error on line 993 of /etc/httpd/conf/httpd.conf:
<VirtualHost> directive requires additional arguments


仔细看了一下,原来是设置时少了一个参数,在网上也发现一些网友也有不少遇到同样问题:

<VirtualHost>

ServerAdmin webmaster@dummy-host.example.com

DocumentRoot /www/docs/dummy-host.example.com

ServerName dummy-host.example.com

ErrorLog logs/dummy-host.example.com-error_log

CustomLog logs/dummy-host.example.com-access_log common

</VirtualHost>


解决方法如下:

NameVirtualHost *:80

然后下面配置虚拟主机设置为:

<VirtualHost *> "这一点不同"

ServerAdmin webmaster@dummy-host.example.com

DocumentRoot /www/docs/dummy-host.example.com

ServerName dummy-host.example.com

ErrorLog logs/dummy-host.example.com-error_log

CustomLog logs/dummy-host.example.com-access_log common

</VirtualHost>

然后运行成功了,如下:


[root@smart ~]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[Sun Oct 26 23:26:49 2008] [warn] NameVirtualHost *:80 has no VirtualHosts
[ OK ]

没有评论:

博客归档