1、找到httpd.conf文件中的Include conf/extra/httpd-vhosts.conf,取消行首的#。這個表示從另外一個專門的虛擬目錄的配置文件來解析不同的訪問路徑。
2、在extra目錄下,找到httpd-vhosts.conf文件,添加一個虛擬目錄的段,代碼如下
<VirtualHost *:80> ServerAdmin admin@example.com DocumentRoot "c:/wamp/www/" ServerName localhost </VirtualHost> <VirtualHost *:8000> ServerAdmin admin@example.com DocumentRoot "F:/glass-project/www.uniir.com" ServerName localhost </VirtualHost>
其中80端口是默認的,另外的你可以設(shè)置其他的端口和對應(yīng)的目錄,可以針對上面的配置相應(yīng)更改一下。
3、在httpd.conf配置文件里面添加相應(yīng)的端口監(jiān)聽,使用Listen命令,代碼如下:
Listen 8000
4、啟動wamp,在瀏覽器地址欄中輸入localhost:8000;
5、如果出現(xiàn)403錯誤,說明目錄權(quán)限有問題,可以直接拷貝對于默認目錄的相關(guān)說明,添加一個新的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、我的已經(jīng)正??梢粤耍ㄟ^訪問8000端口就能看到頁面啦。希望各位朋友也能一切順利。
微信掃碼
關(guān)注PHP中文網(wǎng)服務(wù)號
QQ掃碼
加入技術(shù)交流群
Copyright 2014-2025 http://ipnx.cn/ All Rights Reserved | php.cn | 湘ICP備2023035733號