1. 程式人生 > >配置wamp時區域網報錯403無許可權

配置wamp時區域網報錯403無許可權

原文地址:http://www.nnbbxx.net/post-1426.html

當你安裝好之後開啟httpd.conf看到的原始配置是下面這樣的。原本的這種配置智慧本機訪問,其他人不能訪問。

看見預設的配置你會發現出現了兩個相同的。我感覺是相同的。而且2.5最新版本的httpd.conf檔案預設用記事本開啟是沒有換行的。坑爹

#
# DocumentR.........
#此處省略N行註釋
#..............and aliases may be used to point to other locations.
#
DocumentRoot "D:/wamp/www/"
#
# Each directory.........
#此處省略N行註釋
#..............its subdirectories). 
#
# First, we configure the "default" to be a very restrictive set of 
# features.  
#
<Directory />
    Require all denied
</Directory>
#
# Note that fro.........
#此處省略N行註釋
#..............expect, make sure that you have specifically enabled it
# below.
#
<Directory "D:/wamp/www/">
    #
    # Possible values for the Options directive are "None", "All",
    #此處省略N行註釋
    # for more information.
    #
    Options Indexes FollowSymLinks
    #
    # AllowOverride.........
    #此處省略N行註釋
    #..............ileInfo AuthConfig Limit
    #
    AllowOverride all
    #
    # Controls who can get stuff from this server.
    #
#   onlineoffline tag - don't remove
    Require local
</Directory>

上面也說了上面的配置不行。下面就說說怎麼改。上面我已經粘出來了2處地方,那我們要修改也就是這兩處。

看下面的配置方法。

DocumentRoot "D:/wamp/www/"
<Directory />
    AllowOverride none
    order deny,allow
    allow from all
#    Require all denied
</Directory>

<Directory "D:/wamp/www/">
    Options Indexes FollowSymLinks
    AllowOverride all
    order deny,allow
    allow from all
#    Require local
</Directory>

上面的程式碼看完之後是不是明白了。兩處地方都要修改其他人才能訪問,只修改一處地方那別人訪問的時候就會出現403的現象。

上面的程式碼就是我們把Require local註釋掉,在新增AllowOverride all、order deny,allow、allow from all這三行,其他人就可以訪問了。

但是總覺有兩端相識的有點多餘。你可以這樣。只保留上面的也行。

DocumentRoot "D:/wamp/www/"
<Directory />
    AllowOverride none
    order deny,allow
    allow from all
#    Require all denied
</Directory>
下面的刪除掉。
<Directory "D:/wamp/www/">
    Options Indexes FollowSymLinks
    AllowOverride all
    order deny,allow
    allow from all
#    Require local
</Directory>

我就是這樣解決這個問題的。網上也找不到解決方法,可能是太專業了。我看不懂吧