天天看點

wamp配置多目錄通路方法

綜合網上朋友們的說法并自己實踐了一下,總結大緻步驟如下:

1、找到httpd.conf檔案中的Include conf/extra/httpd-vhosts.conf,取消行首的#。這個表示從另外一個專門的虛拟目錄的配置檔案來解析不同的通路路徑。

2、在extra目錄下,找到httpd-vhosts.conf檔案,添加一個虛拟目錄的段,代碼如下

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "c:/wamp/www/"
    ServerName localhost
</VirtualHost>

<VirtualHost *:8000>
    ServerAdmin [email protected]
    DocumentRoot "F:/glass-project/www.uniir.com"
    ServerName localhost
</VirtualHost>
           

其中80端口是預設的,另外的你可以設定其他的端口和對應的目錄,可以針對上面的配置相應更改一下。

3、在httpd.conf配置檔案裡面添加相應的端口監聽,使用Listen指令,代碼如下:

Listen 8000
           

4、啟動wamp,在浏覽器位址欄中輸入localhost:8000;

5、如果出現403錯誤,說明目錄權限有問題,可以直接拷貝對于預設目錄的相關說明,添加一個新的directory說明,代碼如下:

<Directory "F:/glass-project/www.uniir.com">
    #
    # 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 all granted
</Directory>
           

6、我的已經正常可以了,通過通路8000端口就能看到頁面啦。希望各位朋友也能一切順利。

繼續閱讀