码迷,mamicode.com
首页 > Web开发 > 详细

apache-2.4.12之虚拟主机配置问题与觖决办法

时间:2015-03-28 18:52:00      阅读:131      评论:0      收藏:0      [点我收藏+]

标签:apache-2.4.12虚拟主机配置

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下这样配置完,访问出现403错误,无权限访问。根据提示查看了目录以及文件的权限问题,没有问题;查看程序错误日志和系统日志也没有明显的错误;这时冷静下来好好想了想,目录及文件权限没有问题,那剩下就是站点目录访问权限了,于是在虚拟主机配置文件里面的虚拟主机配置前加入这么一段:


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


    经过以上的修改后,重启apache服务,现在可以正常访问,呵呵,大功能告成!

本文出自 “兰州linux运维” 博客,请务必保留此出处http://linuxzkq.blog.51cto.com/9379412/1626001

apache-2.4.12之虚拟主机配置问题与觖决办法

标签:apache-2.4.12虚拟主机配置

原文地址:http://linuxzkq.blog.51cto.com/9379412/1626001

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!