【发布时间】:2014-01-07 08:33:36
【问题描述】:
我设置 /etc/apache2/extra/httpd-vhosts.conf 如下:
# Ensure that Apache listens on port 80
Listen 80
# Listen for virtual host requests on all IP addresses
NameVirtualHost *:80
<VirtualHost *:80>
ServerName localhost
DocumentRoot /Library/WebServer/Documents/
</VirtualHost>
在 /Library/WebServer/Documents/ 中是标准 index.html.en 文件,在我将 httpd-vhosts.conf 包含到我的 httpd.conf 之前,它已在浏览器中完美显示。
使用 Chrome 和 Firefox 与本地主机的连接失败。设置是否正确?还有什么问题?
【问题讨论】:
-
apache 是否启动了?因为无法连接在我看来它会因配置错误而失败。
-
apachectl start 让我 org.apache.httpd:已经加载。所以我认为它开始了。我也重启了好几次。如果我不包括 httpd-vhosts.conf 一切都会像魅力一样。我还能寻找什么?