xampp 配置多虛擬主機 詳細步驟

2021-07-16 00:25:24 字數 2156 閱讀 9558

檔案目錄 xampp => apach e=>httpd.conf

1.在檔案內搜尋 關鍵字「httpd-vhosts.conf」,找到如下字段

# virtual hosts

include conf/extra/httpd-vhosts.conf//確保此段開頭沒有#

2.在檔案內搜尋關鍵字「allowoverride all」,找到如下字段

"d:/xampp/cgi-bin">

allowoverride all

options

none

require all granted

directory>

//修改為

"d:/xampp/cgi-bin">

options indexes followsymlinks includes execcgi

allowoverride all

order allow,deny

allow from all

directory>

3.搜尋字段「documentroot」,如下

documentroot "d:/xampp/htdocs"

//確保此處路徑是你要訪問的專案的根路徑

4.如果想自定義配置埠,搜尋字段「listen 80」,找到如下

listen

80//在此新增你想監聽的埠,如

listen

80listen

8080

listen

8099

....

檔案目錄 xampp => apache =>conf => extra => httpd-vhosts.conf

檔案最後面可看到如下

##

##serveradmin [email protected]

##documentroot "d:/xampp/htdocs/dummy-host2.example.com"

##servername dummy-host2.example.com

##errorlog "logs/dummy-host2.example.com-error.log"

##customlog "logs/dummy-host2.example.com-access.log" common

##

1.用ip訪問

127.0

.0.5:80>//設定訪問的ip

##serveradmin [email protected]

documentroot "d:/xampp/htdocs"

//你的專案檔案目錄

servername testname.dev//此專案的名稱

##errorlog

"logs/dummy-host2.example.com-error.log"

##customlog

"logs/dummy-host2.example.com-access.log" common

2.用servername訪問

80>

##serveradmin [email protected]

documentroot "d:/xampp/htdocs"

//你的專案檔案目錄

servername testname.dev//此專案的名稱,通過此名稱來訪問專案,還需配置hosts檔案

##errorlog

"logs/dummy-host2.example.com-error.log"

##customlog

"logs/dummy-host2.example.com-access.log" common

3.配置hosts檔案

檔案目錄 c:\windows

\system32\drivers

\etc

\hosts

在檔案中加入

127.0.0.1 testname.dev

xampp 配置多虛擬主機 詳細步驟

檔案目錄 xampp apach e httpd.conf 1.在檔案內搜尋 關鍵字 httpd vhosts.conf 找到如下字段 virtual hosts include conf extra httpd vhosts.conf 確保此段開頭沒有 2.在檔案內搜尋關鍵字 allowoverr...

xampp 虛擬主機配置

測試環境 xampp3.2.1 win7 一 基於埠的虛擬主機 1 apache配置檔案 httpd.conf 改動 a 搜尋 listen 增加兩個新埠 listen 8000 listen 8001 b 搜尋 vhosts 確保 include conf extra httpd vhosts.c...

XAMPP 虛擬主機配置

virtual hosts include conf extra httpd vhosts.conf 確保此段開頭沒有 d xampp cgi bin allowoverride all options none require all granted directory 修改為 d xampp c...