我在configuration基于名称的虚拟主机时遇到了一些麻烦。
我可以用一个空白的httpd.conf文件启动“service apache2 start”服务器,并且它将运行在所有指向/ var / www的地方。
当我填写httpd.conf时:
# Ensure that Apache listens on port 80 Listen 80 # Listen for virtual host requests on all IP addresses NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot /www/kevins_playground ServerName home.coolkev.com # Other directives here </VirtualHost> <VirtualHost *:80> DocumentRoot /www/flatline_and_co ServerName www.flatline_and_co.com # Other directives here </VirtualHost>
运行“service apache2 start”时出现此错误
root@kevin-server:/etc/apache2# service apache2 start * Starting web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName [Thu Jul 26 20:10:01 2012] [warn] NameVirtualHost *:80 has no VirtualHosts (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs Action 'start' failed. The Apache error log may have more information.
我find了解决办法,
我认为这个问题源于parsing这些文件时,Apache发现了两个文件,分别是<VirtualHost>,我的httpd.conf和./sites-available/中的默认网站configuration
只要你没有碰到默认的虚拟主机(它已经包含一个NameVirtualHost *:80指令),你就不应该复制默认的行为。
既然你必须忍受Debuntu,为什么不去用它,把你的虚拟主机放在/ etc / apache2 / sites-enabled /中,每个文件一个?