apache2.4多站點配置教程
阿新 • • 發佈:2019-02-20
1.修改httpd.conf 檔案
分別去掉下面兩行文字前面的#號。
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
去掉#意思是啟用apache的虛擬主機功能。
#Include conf/extra/httpd-vhosts.conf
去掉這一行的#意思是從conf/extra/httpd-vhosts.conf這個檔案匯入虛擬主機配置。
2.新增/修改虛擬機器配置 httpd-vhosts.conf 檔案
虛擬主機配置檔案httpd-vhosts.conf的路徑在:
conf\extra\httpd-vhosts.conf
編輯httpd-vhosts.conf檔案,新增以下內容:
<VirtualHost *:80>
ServerAdmin webmaster@dummy-www.koostore.cn ## 網站管理員的聯絡方式
DocumentRoot "D:/XYPanel/root/koostore" ## 網站的根目錄,這裡的tcioc為資料夾名稱
ServerName www.koostore.cn ## 網站的域名
ErrorLog "logs/dummy-www.koostore.cn-error.log" ## 網站的錯誤日誌
CustomLog "logs/dummy-www.koostore.cn-access.log" common ## 網站的訪問日誌
</VirtualHost>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
3.修改本地DNS指向檔案 hosts檔案 (網上說要,我不新增也可以...)
hosts 檔案的路徑為:
C:\Windows\System32\drivers\etc\hosts
編輯 hosts 檔案,新增以下內容:
127.0.0.1 www.koostore.cn ## 語法: IP地址 + 空格 + 上面設定的虛擬主機域名(ServerName )
儲存檔案之後,重啟 Apache 即可!