Apache 虛擬主機的配置

2021-09-23 17:35:28 字數 815 閱讀 6273

配置虛擬主機的步驟:

① 找到apache配置檔案httpd.conf,讓apache伺服器載入配置虛擬主機的檔案:

#include conf/extra/httpd-vhosts.conf,將前面的注釋去掉

② 修改本機c:\windows\system32\drivers\etc\host檔案把不同的主機名指向相對應的ip

例如:  ip   網域名稱  127.0.0.1   www.baidu.com

? 在apache/conf/extra/httpd-vhosts.conf的末尾寫上:

#配置虛擬主機成功

servername

網域名稱documentroot  **的根目錄路徑

directoryindex  直接訪問的檔案(不是**根目錄)

options indexes followsymlinks

allowoverride none  //是否開啟對url的重寫

order allow,deny    //先允許再禁止

allow from all    //允許所有主機訪問

④ 重啟伺服器

請再此複製配置**

servername	網域名稱

documentroot **的根目錄路徑

directoryindex 直接訪問的檔案(不是**根目錄)

options indexes followsymlinks

allowoverride none

order allow,deny

allow from all

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