在騰訊云上配置好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端口, 所以卸載了 才能正常顯示