服務器 “You don't have permission to access /index.html on this server.”

在騰訊云上配置好wamp之后,服務器上打開 localhost 是可以訪問的。
但是在自己電腦上打開網(wǎng)站,卻顯示
403 forbidden
You don't have permission to access /test.html on this server.

這就納悶了,經(jīng)過一番折騰,找到下面這個靠譜的解決辦法,原來是apache的配置問題

一、httpd.conf文件更改

1、找到httpd.conf文件位置:

在你的wamp安裝目錄下的\bin\apache\apache2.4.9\conf文件夾中。例如路徑為:C:\wamp\bin\apache\apache2.4.9\conf

2、httpd.conf代碼更改

①在第242行左右的位置將

<Directory />  
    AllowOverride none  
    Require all denied  
</Directory>  
更改為:

<Directory />  
    AllowOverride none  
    #Require all denied  
    Require all granted  
</Directory>  

也就是允許其他請求訪問。

②在第284行左右的位置在“Require local”后面加上一句:“Require all granted”

即

<Directory "c:/wamp/www/">  
    #  
    # Possible values for the Options directive are "None", "All",  
    # or any combination of:  
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews  
    #  
    # Note that "MultiViews" must be named *explicitly* --- "Options All"  
    # doesn't give it to you.  
    #  
    # The Options directive is both complicated and important.  Please see  
    # http://httpd.apache.org/docs/2.4/mod/core.html#options  
    # for more information.  
    #  
    Options Indexes FollowSymLinks  
  
    #  
    # AllowOverride controls what directives may be placed in .htaccess files.  
    # It can be "All", "None", or any combination of the keywords:  
    #   AllowOverride FileInfo AuthConfig Limit  
    #  
    AllowOverride all  
  
    #  
    # Controls who can get stuff from this server.  
    #  
  
#   onlineoffline tag - don't remove  
    Require local  
    Require all granted  
</Directory> 

另外
在安裝wampserver之前,我單獨安裝了 php 和 IIS 以及 Mysql,單獨安裝顯得比較麻煩,而且IIS會占用wampserver的80端口, 所以卸載了 才能正常顯示

?著作權歸作者所有,轉載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容