您好,登錄后才能下訂單哦!
apache-2.4.12基于域名訪問的多虛擬主機配置
原始配置:
<VirtualHost *:80>
ServerAdmin kk@etiantian.org
DocumentRoot "/data/cms"
ServerName www.etiantian.org
ServerAlias etiantian.org
ErrorLog "logs/www.etiantian.org-error_log"
CustomLog "logs/www.etiantian.org-access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin kk@etiantian.org
DocumentRoot "/data/bbs"
ServerName bbs.etiantian.org
ErrorLog "logs/bbs.etiantian.org-error_log"
CustomLog "logs/bbs.etiantian.org-access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin kk@etiantian.org
DocumentRoot "/data/blog"
ServerName blog.etiantian.org
ErrorLog "logs/blog.etiantian.org-error_log"
CustomLog "logs/blog.etiantian.org-access_log" common
</VirtualHost>
以上的基于域名訪問的多虛擬主機配置大家能看出錯在哪嗎?乍一看沒有問題,可是在apache-2.4.12下這樣配置完,訪問出現(xiàn)403錯誤,無權(quán)限訪問。根據(jù)提示查看了目錄以及文件的權(quán)限問題,沒有問題;查看程序錯誤日志和系統(tǒng)日志也沒有明顯的錯誤;這時冷靜下來好好想了想,目錄及文件權(quán)限沒有問題,那剩下就是站點目錄訪問權(quán)限了,于是在虛擬主機配置文件里面的虛擬主機配置前加入這么一段:
<Directory "虛擬主機站點目錄">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
再些修改虛擬主機配置文件如下:
<Directory "/data">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
<VirtualHost *:80>
ServerAdmin kk@etiantian.com
DocumentRoot "/data/cms"
ServerName www.etiantian.org
ServerAlias etiantian.org
ErrorLog "logs/www.etiantian.org-error_log"
CustomLog "logs/www.etiantian.org-access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin kk@etiantian.com
DocumentRoot "/data/bbs"
ServerName bbs.etiantian.org
ErrorLog "logs/bbs.etiantian.org-error_log"
CustomLog "logs/bbs.etiantian.org-access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin kk@etiantian.com
DocumentRoot "/data/blog"
ServerName blog.etiantian.org
ErrorLog "logs/blog.etiantian.org-error_log"
CustomLog "logs/blog.etiantian.org-access_log" common
</VirtualHost>
經(jīng)過以上的修改后,重啟apache服務,現(xiàn)在可以正常訪問,呵呵,大功能告成!
免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。