【问题标题】:Connection Refused after Changing Apache DocumentRoot on OS X El Capitan在 OS X El Capitan 上更改 Apache DocumentRoot 后连接被拒绝
【发布时间】:2026-01-28 09:25:01
【问题描述】:

我使用的是 OS X El Capitan,并更改了 Apache2 配置文件 /etc/apache2/http.conf 以重新定位文件路径。

我修改了 DocumentRoot "/Library/WebServer/Documents" 到 DocumentRoot "~/Dropbox/myweb", 和

<Directory "Library/WebServer/Documents"> 

<Directory "~/Dropbox/myweb">. 

目录内容是

Options FollowSymLinks Multiviews
MultiviewsMatch Any
AllowOverride None
Require all granted

并更改文件夹,如

sudo chmod 777 ~/Dropbox/myweb

我重新启动了 Apache,然后我无法再连接到 http://localhost。 Opera 还给我

Opera's connection attempt to localhost was rejected. The website may be down, or your network may not be properly configured.

Chrome 还给我

This webpage is not available
ERR_CONNECTION_REFUSED

我不确定我是否错过了任何步骤?

【问题讨论】:

    标签: apache


    【解决方案1】:

    尝试运行apachectl configtest 以确定您的配置是否都正常。在这里遇到了同样的问题,configtest 告诉我 httpd-userdir.conf 文件有问题。

    【讨论】:

    • 我的配置测试说Syntax OK...还有其他想法吗?