1. 程式人生 > >php多站點配置以及Forbidden You don't have permission to access / on this server問題解決

php多站點配置以及Forbidden You don't have permission to access / on this server問題解決

前幾天在電腦上配置多站點的後突然出現了:”You don’t have permission to access / on this server!“ 究其原因是:swampserver預設訪問的是www資料夾的站點,不允許訪問其他的站點。花了老半天的時間解決了。分享一下希望幫助需要的人

first:首先教你如何配置多站點

  1. 在”C:\wamp\bin\apache\apache2.4.9\conf“目錄下開啟httpd.conf配置檔案
    大概516行左右在找到
    # Virtual hosts
    #Include conf/extra/httpd-vhosts.conf
    把include 的註釋去掉,讓他去載入conf/extra/httpd-vhosts.conf檔案

  2. 在”C:\wamp\bin\apache\apache2.4.9\conf\extra“目錄開啟
    httpd-vhosts.conf檔案,直接在這裡配置站點
    上面全部註釋,第一句
    NameVirtualHost *:80(設定埠號)
    # #以下是自己配置的站點1
    < VirtualHost *:80 >
    ServerName www.xiaozheng.com (網站的域名)
    DocumentRoot “C:\wamp\www” (檔案的路徑)
    < Directory “C:\wamp\www” > (檔案的路徑)
    Options Indexes
    Order allow,deny
    Allow from all
    Satisfy all
    < /Directory >
    < /VirtualHost >

    3.在“C:\Windows\System32\drivers\etc”的hosts檔案裡面配置
    就可以了

但是昨天我在這樣子配置的時候出現了一個問題~~如果說我的檔案路徑在wamp\www以外的話,比如“F:\xiaozheng”會出現“You don’t have permission to access / on this server!”問腿!接下來教你如何解決這個問題

首先:swampserver伺服器預設是隻能訪問站內的資料夾,在http.conf檔案裡面有
< Directory />
AllowOverride all
Require all denied (拒絕了外部的訪問)
< /Directory >
必須把上面的改成:
< Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
#Deny from all
Allow from all
#允許所有訪問
Satisfy all
< /Directory>

第二步:
< Directory “D:/Wamp5/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.2/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:
#   Options FileInfo AuthConfig Limit
#
AllowOverride all

#
# Controls who can get stuff from this server.
#
onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1

< /Directory>

修改成

< Directory “D:/Wamp5/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.2/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:
#   Options FileInfo AuthConfig Limit
#
AllowOverride all

#
# Controls who can get stuff from this server.
#
#  onlineoffline tag - don't remove
Order Deny,Allow
#Deny from all

# Allow from 127.0.0.1
Allow from all

< /Directory>

其實是可以把一些不必要的註釋刪掉的,我是把那些註釋刪掉了,簡潔了好多,配圖
這裡寫圖片描述

或者還有一種新的解決方法,在httpd-vhosts.conf配置站點的時候這樣配置
< VirtualHost *:80 >
ServerName www.xiaozheng.com
DocumentRoot “C:\wamp\www”

<Directory "C:\wamp\www">
    Options Indexes FollowSymLinks   #原先是Options Indexes
    AllowOverride all                #原先是沒有這句的,這兩句不管是否超出先限制的檔案
                                     範圍,都可以訪問,就不會出現許可權問題了
    Order allow,deny
    Allow from all  
    Satisfy all
</Directory>

< /VirtualHost>

然後儲存,重啟服務,在訪問就解決了這個問題。

希望對新手有幫助

相關推薦

php站點配置以及Forbidden You don't have permission to access / on this server問題解決

前幾天在電腦上配置多站點的後突然出現了:”You don’t have permission to access / on this server!“ 究其原因是:swampserver預設訪問的是www資料夾的站點,不允許訪問其他的站點。花了老

apache2.4 報Forbidden You don't have permission to access / on this server.

檢視apache版本D:\phpStudy\PHPTutorial\Apache\bin>httpd -v Server version: Apache/2.4.23 (Win32) Server

MAMP "403 Forbidden You don't have permission to access / on this server."

    用MAMP搭建本地伺服器的時候,設定好ip和埠等屬性之後,瀏覽器訪問,報 403錯誤:  Forbidden   You don't have permission to access / on this server. 主要有以下方法是: 將 /Applicat

You don't have permission to access / on this server. --->解決方法

有的時候,比如做Apache專案時(Hudson),你或許會遇到 You don't have permission to access / on this server. 錯誤,提示你沒有許可權訪問,這個時候 你除了check 777 許可權外(chmod 777 xxx

You don't have permission to access on this server解決辦法

安裝好wampserver想在瀏覽器開啟執行php的結果,發現: You don't have permission to access on this server 解決辦法是: 在wampserver-Apache的httpd.conf檔案下修改一處資訊: 把大概處

wamp You don't have permission to access / on this server.解決方法

在使用ip地址訪問wamp的時候報錯You don't have permission to access / on this server.,使用localhost可以訪問 解決方法: 先找到Apa

wamp配置出現You don't have permission to access / on this server.

<Directory />     Options FollowSymLinks     AllowOverride None     Order deny,allow     Allow from all </Directory>

WampServer出現You dont have permission to access/on this server提示

ron 服務 mps all -m 如何 onf sta highlight WampServer出現You don’t have permission to access/on this server提示 本地搭建WampServer,輸入http://127.0.0

mac osx下apache下的坑: you dont have permission to access / on this server

pos require tor director div http localhost mce pan 在Mac下Apache修改默認站點的目錄時,遇到403錯誤, you don’t have permission to access / on this server

wamp出現You dont have permission to access/on this server提示

本地搭建wamp,輸入http://127.0.0.1訪問正常,當輸入http://localhost/,apache出現You don't have permission to access/on this server.的提示,如何解決?

解決mac os You don't have permission to access / on this server(如果你嘗試了很多辦法還不行可以試試這個)

  其實如果自己 DocumentRoot "/apache/webRoot" <Directory "/apache/webRoot"> 這兩個都改了之後發現還是forbidden,那應該就不是什麼directory問題了,這時候有兩種情況: 如果你那個目

Apache提示You don't have permission to access / on this server 解決

昨天修改apache配置,不小心搞得報錯:You don't have permission to access / on this server。 不得已,拿原始未經,從新修改了一遍,還是不行,網上都是一樣的答案,改什麼 <Directory> ,結果還是不可以,資料夾許可權都777了

安裝wamp 解決IIS埠衝突You don't have permission to access / on this serve

# wamp - 安裝wamp 1. 下載 2. 一定要裝vc++2012 因為phh 2.5以上依賴。不然可能會遇到缺少mvc110.dll 如果出現安裝VC++之後解除安裝重灌 3.

phpstudy配置域名站點You don't have permission to access / on this server解決方案

先配置好站點,如果你沒配置,請參考: https://blog.csdn.net/qq_42249896/article/details/85047136 當我們配置好了,卻顯示: 這時,我們在檢查一下本地配置: 解決方案: 一、刪除apche的配置檔案vhosts.con

xampp:Access forbidden!You don't have permission to access the requested directory.

D:\xampp\apache\conf\extra下httpd-vhosts.conf的配置如下: NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot "D:/xampp/htdocs"

CentOS出錯You don&#39;t have permission to access on this server

bre 文件的 utl 微軟 oot mar eight allow base 檢查http.conf發現沒錯之後,查找資料後發現時selinux的問題,所以須要關閉這個服務: 1 vi /etc/sysconfig/seli

apache2.4 You dont have permission to access / on

mission index ESS per 2.4 system win follow mis apache2.4 You don‘t have permission to access / on this server. 在配置完apache2.4conf/extra/h

Linux Centos7 Apache 訪問 You don't have permission to access / on this server.

折騰了很久,今天才找到了最正確的答案。感言真不容易。 百度出來的99%都是採集的內容,全都是錯誤的。 You don't have permission to access / on this server. 百度出的解決方法: 1)關閉selinux 。坑,伺服器根本就沒開啟selin

Apache Version: 2.4.33 提示You don't have permission to access / on this server 的錯誤

需要修改 apache的配置檔案  httpd.conf 和 httpd-chosts.conf 這兩個配置檔案 1、將httpd.conf 中的denied 修改為 granted 2 、把 httpd-chosts.conf 中的require local

【Apache】You don't have permission to access / on this server.問題解決

背景 在伺服器中輸入localhost出現 Forbidden,You don't have permission to access / on this server. 在外部伺服器輸入域名也是出現如上錯誤 正文  查了谷歌百度,按照他們給出的方法