xampp新增虛擬主機的操作

2021-10-01 12:33:00 字數 1843 閱讀 4359

檔案目錄 xampp => apache =>conf => httpd.conf

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

virtual hosts

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

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

allowoverride all

options none

require all granted

//修改為

options indexes followsymlinks includes execcgi

allowoverride all

order allow,deny

allow from all

搜尋字段「documentroot」,如下

documentroot 「d:/xampp/htdocs」//確保此處路徑是你要訪問的專案的根路徑

ps:可以配置特定的根路徑,比如: documentroot 「d:/www」

二、修改httpd-vhosts.conf

檔案目錄 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

##

用ip訪問

//設定訪問的ip

##serveradmin [email protected]

documentroot "d:/www"//你的專案檔案目錄

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

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

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

用servername訪問

##serveradmin [email protected]

documentroot "d:/www"//你的專案檔案目錄

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

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

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

配置hosts檔案

檔案目錄 c:\windows\system32\drivers\etc\hosts

在檔案中加入

127.0.0.1   testname.dev
三、修改完記得重啟aphache在進行訪問

三、修改完記得重啟aphache在進行訪問

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...

xampp配置虛擬主機

xamp目錄 apache conf extra httpd vhosts.conf vhost.conf其中給的一些例子,我們寫的時候需要去掉 號,表示注釋的意思。serveradmin webmaster dummy host.example.com documentroot c xampp h...