【发布时间】:2026-02-13 17:15:02
【问题描述】:
我使用 Linux Mint 16 + 最新的 LAMP + Laravel。
当我尝试通过“localhost”或“127.0.0.1”查看我的网站时遇到此错误。
Forbidden
You don't have permission to access / on this server.
------------------------------------------------------
Apache/2.4.6 (Ubuntu) Server at 127.0.0.1 Port 80
我的设置如下:
在 /etc/主机名上
NameServer ynwlocalwebserver
在 /etc/hosts 上
127.0.0.1 localhost
127.0.1.1 ynwlocalwebserver
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
我只有一个名为“ynwlocalwebserver.conf”的站点启用它的当前内容是:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName ynwlocalwebserver
DocumentRoot /home/ynwmint/ynw/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /home/ynwmint/ynw/public>
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName localhost
DocumentRoot /home/ynwmint/ynw/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /home/ynwmint/ynw/public>
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
“/home/ynwmint/ynw/public”中的文件夹 ynw 就是 Laravel 项目。
我把 public 文件夹的 chmod 设置为 777(同时)并在 www-data:www-data 下chown
我做错了什么,或者我还需要检查什么?
谢谢。
【问题讨论】: