我可以使用“service apache2 start”启动服务器,其中包含一个空白的httpd.conf文件,并且它将按预期运行所有指向/ var / www的内容.
当我用http填充httpd.conf时:
# Ensure that Apache Listens on port 80Listen 80# Listen for virtual host requests on all IP addressesnameVirtualHost *:80<VirtualHost *:80>documentRoot /www/kevins_playgroundServername home.coolkev.com# Other directives here</VirtualHost><VirtualHost *:80>documentRoot /www/flatline_and_coServername www.flatline_and_co.com# Other directives here</VirtualHost>
运行“service apache2 start”时出现此错误
root@kevin-server:/etc/apache2# service apache2 start * Starting web server apache2apache2: 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:80no Listening sockets available,shutting downUnable to open logsAction 'start' Failed.The Apache error log may have more information.
我找到了一个解决方案
>我删除了对httpd.conf的所有更改,对我来说,这留下了一个空白文件.
>我为./sites-available/复制了现有的默认站点文件,用于我的两个虚拟主机.
>我编辑了这两个文件,并在有意义的地方替换了值,我认为应该明确他们需要更改的位置(网站基础文件夹,网站URL).
>我创建了sym-links,就像你应该在./sites-enabled/
>我重新启动了web服务器’sudo service apache2 restart’,它运行正常.
我认为这个问题源于这样一个事实,即在解析文件时,Apache发现了两个带有“< VirtualHost>”的文件,我的httpd.conf和./sites-available/中的默认网站配置.
解决方法 只要您没有触及默认vhost(已经包含nameVirtualHost *:80指令),就不应该复制默认行为.既然你不得不忍受Debuntu,为什么不去使用它并将你的vhost放在/ etc / apache2 / sites-enabled /中,每个文件一个?
总结以上是内存溢出为你收集整理的linux – Apache中基于名称的虚拟主机全部内容,希望文章能够帮你解决linux – Apache中基于名称的虚拟主机所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)