Apache 配置虛擬主機

2021-06-08 13:19:04 字數 855 閱讀 2746

apache 配置虛擬主機。

下面是配置步驟:

# virtual hosts

# include conf/extra/httpd-vhosts.conf #去掉這行前面的 # 號

去掉上面的#號,表示:載入虛擬主機的配置檔案

2、apache 安裝目錄, conf/extra/ 下找到 httpd-vhosts.conf,開啟新增如下**:

# 配置虛擬主機

#設定訪問本機位址

documentroot "e:/php/apache/htdocs"

servername sina.com

#配置預設頁面

directoryindex index.shtml index.html index.htm index.php

#如果沒有預設頁面的話,是否顯示列表

#options indexes followsymlinks 表示允許顯示目錄列表

options followsymlinks

#是否允許rewrite

allowoverride all

#設定訪問許可權

order allow,deny

allow from all

儲存關閉!

3、找到 c:\windows\system32\drivers\etc\hosts,具體的系統碟符按實際而定。

開啟 hosts 檔案,在後面追加**:

127.0.0.1       www.sina.com

這樣就完成虛擬主機的配置了。

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