You don’t have permission to access / on this server error 之解决
配置好的 apache 虚拟主机,已经跑着一个web应用,现在绑定了另外一个域名:
环境: apache2 + php5
vi http.conf
NameVirtualHost *:8080
<VirtualHost www.abc.net:8080>
ServerName www.abc.net
ServerAdmin test@abc.net
DocumentRoot /usr/local/apache/htdocs/2hei.net
</VirtualHost>
<VirtualHost www.asd.net:8080>
ServerName www.asd.net
ServerAdmin postmaster@asd.net
DocumentRoot /home/asd/htdocs
</VirtualHost>
访问网站:www.asd.net:8080 系统提示:
You don’t have permission to access / on this server error
403(禁止)
原因是默认的apache配置里面已经设定了目录访问权限
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
在设定NameVirtualHost时,也是遵循这个规则,
所以应该在 VirtualHost 中单独指定发布目录的目录访问权限。
NameVirtualHost *:8080
<VirtualHost www.abc.net:8080>
ServerName www.abc.net
ServerAdmin test@abc.net
DocumentRoot /usr/local/apache/htdocs/2hei.net
</VirtualHost>
<VirtualHost www.asd.net:8080>
ServerName www.asd.net
ServerAdmin postmaster@asd.net
DocumentRoot /home/abc/htdocs
<Directory “/home/asd/htdocs”>
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
接着访问你的网站:www.asd.net:8080 应该可以了。
本文固定链接: https://www.2hei.net/2008/03/18/dont_have_permission_access/ | 2hei.net
最活跃的读者