apache虛擬主機配置方法

2021-09-01 17:33:18 字數 1331 閱讀 4434

apache php 需要配置環境變數 還有乙個dll檔案需要copy到windows/system32下

win7 配置虛擬機器:經測試成功

1. 開啟目錄 \conf\extra\, 找到 httpd-vhosts.conf 檔案.

2. 仿照例子, 新增一段**來指定某一網域名稱的**.

## documentroot 是**檔案存放的根目錄

# servername 是**網域名稱, 需要跟 dns 指向的網域名稱一致

#documentroot "f:/wamp/www/test"

#這裡配置歡迎首頁面

directoryindex index.html index.htm index.php

options followsymlinks

#不許可別人修改頁面

allowoverride none

#設定訪問許可權

order allow,deny

allow from all

3. 開啟 httpd.conf 檔案, 新增如下語句.

(去掉前面的#號)

# virtual hosts

include conf/extra/httpd-vhosts.conf(開啟了httpd-vhosts虛擬主機檔案,localhost無法開啟 需要重新配置一下)

4. 重啟 apache 服務.

5.配置 hosts檔案

貌似這個方法不行~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1:apache-->conf-->http.conf 第210行左右 新增

//虛擬路徑 尋找index.php

options indexes followsymlinks

allowoverride none

order allow,deny

allow from all

2:apache-->conf-->extra-->httpd-vhosts.conf 50行左右新增

documentroot e:/code/newhelp/www //虛擬路徑 尋找index.php

servername help.baidu.com //虛擬主機網域名稱

3:c:/windows-->system32-->drivers-->etc-->host檔案 新增

127.0.0.1 help.baidu.com //**指向本地路徑

//-----

4:apache-->conf-->http.conf第280行左右

directoryindex index.html index.php //預設直接開啟index.html 和 index.php

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