我在这里创build了第一个服务器,在这里设置了Apache2上的域。
当我尝试运行/etc/init.d/apache2 restart
此错误:
[Mon Oct 29 11:47:17 2012] [warn] NameVirtualHost *:80 has no VirtualHosts [Mon Oct 29 11:47:17 2012] [warn] NameVirtualHost *:80 has no VirtualHosts
这是我的/etc/apache2/conf.d/virtual.conf
# # We're running multiple virtual hosts. # NameVirtualHost *:80
这是我的/etc/apache2/sites-available/www.x.com
# # Example.com (/etc/apache2/sites-available/www.x.com) # <VirtualHost *:80> ServerAdmin [email protected] ServerName www.x.com ServerAlias x.com # Indexes + Directory Root. DirectoryIndex index.php index_screw.php index.html DocumentRoot /home/www/www.x.com/htdocs/ # CGI Directory ScriptAlias /cgi-bin/ /home/www/www.x.com/cgi-bin/ <Location /cgi-bin> Options +ExecCGI </Location> # Logfiles ErrorLog /home/www/www.x.com/logs/error.log CustomLog /home/www/www.x.com/logs/access.log combined </VirtualHost>
这是我的/etc/apache2/conf.d/httpd.conf
ServerName www.x.com
这是我的/etc/apache2/conf.d/ports.conf
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>
你所要做的就是删除或评论(#)
名称虚拟主机*:80
在ports.conf上
根据教程: –
“与conf.d目录一样,启动站点的目录中的每个configuration文件在服务器启动时加载,而站点中的文件可用则完全被忽略。
您需要在/ etc / apache2 / sites-available中创build主机configuration文件,然后在启用站点的目录中创build这些文件的符号链接 – 这将导致它们被实际加载/读取。
是你做的吗?