【发布时间】:2020-05-19 23:18:52
【问题描述】:
我有一些 PHP Web 应用程序在 macOS 10.15 上运行 XAMPP 7.4.1。 XAMPP 过去曾为我工作过。我把我的开发环境搞砸了,因为 32 位应用程序在 Catalina 的床上,而且我的旧 XAMPP 安装没有打开。我恢复了我的 VirtualHosts 设置,但现在当我尝试访问我的一个网站时,我收到以下错误。
Access forbidden!
You don't have permission to access the requested directory. There is
either no index document or the directory is read-protected.
If you think this is a server error, please contact the webmaster.
Error 403
我的虚拟主机如下所示:
# localhost
<VirtualHost *:80>
ServerName localhost
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
<Directory "/Applications/XAMPP/xamppfiles/htdocs">
Options Indexes FollowSymLinks Includes execCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
#####################
# PERSONAL PROJECTS #
#####################
# Dunsparce.net
<VirtualHost *:80>
ServerName dunsparce.net
DocumentRoot "/Users/danielschnoll/Documents/Projects/Dunsparce.net"
<Directory "/Users/danielschnoll/Documents/Projects/Dunsparce.net">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
ErrorLog "logs/dunsparce-error_log"
</VirtualHost>
我列出了更多虚拟主机,它们都遵循相同的格式。我每个都有Require all granted,还有Allow Override All 和Options... 行。就像我在帖子开头所说的那样,他们过去都工作过。我的 httpd.conf 文件中也有 # Include 未注释,尽管我很确定 Access Forbidden 错误与它完全无关。
有什么想法吗?
【问题讨论】:
-
试试这个。检查
htdocs文件夹的权限。可能重复:stackoverflow.com/questions/22951499/… -
@TPHughes 与
htdocs无关,我没有任何项目存储在那里。htdocs唯一的东西是localhost的登陆仪表板,它加载得很好。其他所有内容都有“权限被拒绝” -
如果本地主机登陆页面的权限不正确,可能会导致它。但如果不是,那也没关系。修剪那里的其余 cmets,还有更多建议。确保每次更改后重新启动 apache。
标签: php macos apache xampp virtualhost