linux – Apache中基于名称的虚拟主机
我在配置基于名称的虚拟主机时遇到了一些麻烦.
我可以使用“service apache2 start”启动服务器,其中包含一个空白的httpd.conf文件,并且它将按预期运行所有指向/ var / www的内容. 当我用http填充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. 我找到了一个解决方案 >我删除了对httpd.conf的所有更改,对我来说,这留下了一个空白文件. 我认为这个问题源于这样一个事实,即在解析文件时,Apache发现了两个带有“< VirtualHost>”的文件,我的httpd.conf和./sites-available/中的默认网站配置. 解决方法
只要您没有触及默认vhost(已经包含NameVirtualHost *:80指令),就不应该复制默认行为.
既然你不得不忍受Debuntu,为什么不去使用它并将你的vhost放在/ etc / apache2 / sites-enabled /中,每个文件一个? (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |