Apache配置本地虚拟主机403问题解决
Forbidden
You don't have permission to access / on this server.
Listen 80 NameVirtualHost *:80 <VirtualHost *:80 > ServerAdmin example@company.com DocumentRoot yourRoot <Directory "yourRoot "> Options FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> </VirtualHost> |
1.按上面的配置正确,特别是:
Order allow,deny
Allow from all
2.确保youRoot文件夹下有index.html文件(或名为index而后缀为其他形式(如.jsp .php等)的文件),因为Apache默认以index.html为网站首页,如果没有这个文件就会出现上面的403错误。
注:如果你想以其他形式的文件(如:index.jsp或index.php等)作为出现的网页,可将Apache的配置文件中的:
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
改为(如你想用index.jsp):
<IfModule dir_module>
DirectoryIndex index.html index.jsp
</IfModule>
如果需要浏览该文件夹下的内容,可以在</Directory>前添加:
Options Indexes
就可以了。