我正在尝试在 Linux/Ubuntu 中创建本地环境。
我已经安装了 Apache 2.4.7(使用 apt-get)。
我已将 /etc/hosts 更改为:
127.0.0.1 example.dev
127.0.0.1 localhost
...
我还在“/etc/apache2/sites-available”中添加了一个文件“example.dev.conf”,如下所示:
<VirtualHost *:80>
ServerName example.dev
DocumentRoot "/home/yahya/path/to/projec"
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory "/home/yahya/path/to/project">
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
但是当我转到 example.dev 时,我收到以下消息:
第403章 禁止!您没有权限访问此服务器上的 /。
我还编辑了 apache.conf 部分<Directory />
来自此链接的建议:禁止访问 您无权访问此服务器上的 / https://stackoverflow.com/questions/21551840/forbidden-you-dont-have-permission-to-access-on-this-server and 错误消息“禁止您无权访问此服务器上的/” https://stackoverflow.com/questions/10873295/error-message-forbidden-you-dont-have-permission-to-access-on-this-server
from:
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
to
<Directory />
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order deny,allow
Require all granted
</Directory>
我用过a2ensite。但还是不行。