Apache配置本地虛擬主機403問題解決
Forbidden
You don't have permission to access / on this server.
Listen 80 NameVirtualHost *:80 <VirtualHost *:80 > ServerAdmin [email protected] 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
就可以了。