apache 配置虛擬主機

2022-04-10 23:25:23 字數 1560 閱讀 8055

1.查詢httpd.conf所在的位置

2.修改httpd.conf

vi /usr/local/apache/conf/httpd.conf
取消注釋以下兩行

檢視虛擬主機配置檔案位置

可以看到,虛擬主機檔案在目錄/usr/local/apache/conf/vhost

3.修改虛擬主機配置檔案:vi vhost/

default

.conf

documentroot 和 directory 的值是相同的,即是子站的目錄
80>documentroot /data/www/default/zblog

servername zblog.com

default/zblog>setoutputfilter deflate

options followsymlinks

allowoverride all

order deny,allow

allow

from

all directoryindex index.php index.html index.htm

80>documentroot /data/www/default/wordpress

servername uuu.com

default/wordpress>setoutputfilter deflate

options followsymlinks

allowoverride all

order deny,allow

allow

from

all directoryindex index.php index.html index.htm

重啟一下服務 service httpd restart

4.修改hosts檔案做測試:

ip改為你自己的伺服器ip,網域名稱即為上面配置的servername

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