APACHE配置虛拟目錄、一個站點使用多域名配置方式
我們在apache的httpd.conf檔案中搜尋VirtualHost 可能搜尋到好幾個可能都不是我們看到如下的内容,那麼我們就把下面的複制放到某個地方
#<VirtualHost *:80>
# ServerAdmin [email protected]
# DocumentRoot "/xampp/htdocs/"
# ServerName localhost
# ServerAlias localhost 127.0.0.1
# ErrorLog "logs/localhost-error.log"
# CustomLog "logs/localhost-access.log" common
#</VirtualHost>
相應的解釋,多個站點就複制多個,這個雖然沒有可視化工具那麼好用,但是熟練了,用起來反而很友善
<VirtualHost *:80>
ServerAdmin [email protected] #管理伺服器的郵箱 一般都不需要填寫
DocumentRoot "網站路徑" #網站的目錄
ServerName www.tp5.com #需要綁定的域名
ServerAlias www.tp5.com www.tp6.com #綁定多個域名用空格隔開
DirectoryIndex example.php #設定預設的通路的頁面
ErrorLog "logs/dummy-host.example.com-error.log" #錯誤日志目錄
CustomLog "logs/dummy-host.example.com-access.log" common #用戶端日志
</VirtualHost>