Apache配置虛擬主機

2021-07-03 10:12:42 字數 537 閱讀 9025

乙個目錄下部署了多個專案,而需要通過某個網域名稱直接訪問某個目錄,這時通過配置虛擬主機可以解決這個問題。

1.開啟apache的配置檔案httpd.conf,並去掉#include conf/extra/httpd-vhosts.conf前面的#

2.開啟apache的apache/conf/extra下的次配置檔案httpd-vhosts.conf

3.在末尾增加

documentroot c:/wamp/www/demo

servername php.com

options indexes followsymlinks

allowoverride all

order allow,deny

allow from all

4.配置網域名稱

c:\windows\system32\drivers\etc

開啟hosts檔案:

127.0.0.1       php.com

5.重啟apache

6.訪問

直接訪問到demo目錄下。

apache虛擬主機配置

之前已經在csdn上上傳過apache的文件在這裡補充說明一下,apache2.2.x與tomcat或iis或三者之間的虛擬主機配置。介紹一下如何整合其他 web伺服器,如 iis tomcat 等。網上有 n多整合方案講的都不是很清楚 特別是 windows 下的 這裡要特別提示一下,apache...

apache虛擬主機配置

多個網域名稱 伺服器 對應乙個 ip 位址,配置方法為 namevirtualhost 111.22.33.44 servername www.sample.com documentroot www sample servername www.sample2.com documentroot www...

apache配置虛擬主機

namevirtualhost 80 directoryindex default.php index.html index.php index.htm servername www.host1.com servername host1 com documentroot d wamp www1 er...