配置虛擬主機的方法

2021-08-18 11:09:20 字數 954 閱讀 5281

通過sublime編輯器開啟 c:/windows/system32/drivers/etc/hosts  

在最下方書寫:127.0.0.1    www.test.com(虛擬主機網域名稱)

注意:如果沒有辦法儲存,你需要將hosts檔案複製到桌面乙份,在桌面進行修改之後,再覆蓋回etc目錄中即  可

然後,開啟 d:/wamp64/bin/apache/apache2.4.23/conf/httpd.conf,搜尋 include conf/extra/httpd-vhosts.conf,將其之前的井號去除(此處的目錄根據自己目錄的名字自行修改,下面的位址也一樣)

然後,開啟同級目錄下的 extra 目錄,找到 httpd.vhost.conf 檔案,並進行開啟,複製如下**,並修改servername、documentroot以及directory的內容為自己的虛擬主機網域名稱和專案根目錄所在地

servername localhost

documentroot d:/wamp64/www

options +indexes +includes +followsymlinks +multiviews

allowoverride all

require local

# require all granted

修改之後,是如下樣式

servername www.web1711.com

documentroot d:\wamp64\www\week7\day01\web1711\public

options +indexes +includes +followsymlinks +multiviews

allowoverride all

require local

# require all granted

注意:路徑的斜線應當修改正正斜線,可以使用 ctrl + h 進行查詢替換操作。

最後:重啟伺服器即可!

apache虛擬主機配置方法

apache php 需要配置環境變數 還有乙個dll檔案需要copy到windows system32下 win7 配置虛擬機器 經測試成功 1.開啟目錄 conf extra 找到 httpd vhosts.conf 檔案.2.仿照例子,新增一段 來指定某一網域名稱的 documentroot ...

Nginx配置虛擬主機方法

就是在一台伺服器啟動多個 1 網域名稱不同 2 埠不同 通過埠區分不同虛擬機器 nginx的配置檔案 可以配置多個server,配置了多個虛擬主機。新增虛擬主機 複製乙份server之後,修改相關資訊就可以了 server 重新載入配置檔案 root localhost nginx sbin ngi...

配置虛擬主機

在一台web伺服器中配置多個 的過程稱之為配置虛似主機,配置虛似主機可以實現在一台web伺服器上放多個 即不論是使用者訪問www.sina.com或www.sohu.com,訪問的都是同一臺機器。這樣我們訪問http www.google.com news就能訪問到c google news 訪問h...