You don't have permission to access / on this server error 之解决

作者: 2hei 发表于2008年3月18日 20:54
版权声明: 可以转载, 转载时务必以超链形式标明文章原始出处和作者信息及版权声明
http://www.2hei.net/mt/2008/03/dont-have-permission-access.html

配置好的 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  应该可以了。

 

| | Comments (0) | TrackBacks (0)

发表一个评论

关于这篇文章

这篇文章由2hei2008年3月18日 20:54发布.

上一篇:不按套路出牌的爬虫!!

下一篇:Apache/resin log输出格式

回到首页 或者查看归档文章