尝试设置我的网络服务器并在所有www目录中允许.htaccess。在我的笔记本电脑上访问sub.domain.com(调整主机文件)时,返回403 Forbidden。 “您无权访问此服务器上的/。”
感觉就像.htaccess文件是不允许的,因此会抛出403.但根据我的理解,设置是否正确不是?我忽略了什么吗?
apache2.conf
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
AllowOverride All
</Directory>
domain.com.conf
<VirtualHost *:80>
ServerName domain.com
ServerAlias sub.domain.com
ServerAdmin webmaster@domain.com
DocumentRoot /var/www/domain.com/public_html/support/current
<Directory "/var/www/domain.com/public_html/support/current">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:443>
ServerName domain.com
ServerAlias .domain.com
ServerAdmin webmaster@domain.com
DocumentRoot /var/www/domain.com/public_html/support/current
<Directory "/var/www/domain.com/public_html/support/current">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
答案 0 :(得分:1)
/var/www/domain.com/public_html/support/current
不存在,或者对于运行Apache的用户,其权限不正确。检查主Apache配置中的User
和Group
设置,了解它们是什么。
您可能还想查看错误日志以获取更多线索。