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

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服务,现在可以正常访问,呵呵,大功能告成!

apache-2.4.12之虚拟主机配置问题与觖决办法的更多相关文章

  1. 在Apache中利用ServerAlias设置虚拟主机接收多个域名和设置域名泛解析

    ServerAlias:服务器别名,在Apache中可以用于设置虚拟主机接收到个域名,也可以用于接收泛解析的域名.具体的设置方法如下: 一.用于设置虚拟主机接收多个域名 一个虚拟主机常常会接收多个域名 ...

  2. Apache httpd.conf配置文件 3(虚拟主机)

    ### Section 3: Virtual Hosts 第三部分 虚拟主机 注意:在使用虚拟主机前,请先检查  http.conf 的 辅助配置文件httpd-vhosts.conf 是否注释 # ...

  3. apache 多端口配置和虚拟主机配置

    1 打开httpd.conf文件 2 添加端口监听 (找到Lisen 80 在后面添加 Listen 端口号 如Listen 1112) port =>你的端口 project_name=> ...

  4. 本地机apache配置基于域名的虚拟主机详解

    1.打开apache的httpd.conf文件,找到# Virtual hosts#Include conf/extra/httpd-vhosts.conf这一段把Include conf/extra ...

  5. Apache配置基于IP的虚拟主机 Apache virtual host configuration is based on the IP

    Step 1: 检查是否开启 httpd-vhosts.conf apache/conf/httpd.conf文件 # Virtual hosts Include conf/extra/httpd-v ...

  6. apache配置文件详解及虚拟主机的搭建

    1.404跳转: <IfModule dir_module>    DirectoryIndex index.php index.html /error.php</IfModule& ...

  7. apache WEB服务器安装(包括虚拟主机)

    一.apache下载编译安装 yum install apr apr-devel apr-util apr-util-devel gcc-c++ wget tar -y cd /usr/src wge ...

  8. Wampserver2.5配置虚拟主机出现403 Forbidden解决办法

    一直在用APMServ5.2.6,mysql好办,可以用mariadb代替进行升级,但php升级到5.4.7就没办法再升级,安装加速器也困难.就想迁移到Wampserver上来,以前也尝试过Wamps ...

  9. 大约apache 2.4.X虚拟主机配置问题的版本号后,

    重装系统,习惯性下载最新的wamp2.5,在各种配置,然后一切正常反应.数据库,代码. 然后打开浏览器,尼嘛,幸运的是,昨天,与虚拟域,其实403该. apache error log的信息是:AH0 ...

随机推荐

  1. Android 高级UI设计笔记02:可以拖动交换item位置的GridView(转载)

    如果大家不知道GridView基本使用,可以先参见:Android(java)学习笔记154:使用GridView以及重写BaseAdapter 1. 首先我们明白GridView拖拽的思路: ()根 ...

  2. Javascript oop深入学习笔记(三)--javascript中类的实现

    一.类的实现机制 在javascript中可以使用function关键字来定义一个类.在函数内通过this指针引用的变量或则方法都会成为类的成员. function classDemo(){ var ...

  3. [转]Oracle EBS APIs

    FROM:http://blog.csdn.net/pan_tian/article/details/7754598 API To Find Sales Order's Subtotal,discou ...

  4. Android 自学之选项卡TabHost

    选项卡(TabHost)是一种非常实用的组件,TabHost可以很方便地在窗口上放置多个标签页,每个标签页相当于获得了一个与外部容器相同大小的组建摆放区域.通过这种方式,就可以在一个容器中放置更多组件 ...

  5. Linux下VirtualBox出现kernel driver not installed的解决方法

    今天安装好rhel-server-6.6-i386后,再安装VirtualBox成功,但是再VirtualBox中创建虚拟机的时候出现了“不能为xx虚拟机打开新任务” 并弹出如下的错误信息:

  6. java 调用OpenOffice将word格式文件转换为pdf格式

    一:环境搭建 OpenOffice 下载地址http://www.openoffice.org/ JodConverter 下载地址http://sourceforge.net/projects/jo ...

  7. vb.net 使用 Regex Replace 正则 替换 Html字串的table中tbody第一个tr下的td为th

    本次示例效果如下: TextBox1中输入如下字符串: 12<table><tbody><tr><td>1<br/>11</td> ...

  8. LeetCode 344

    Reverse String Write a function that takes a string as input and returns the string reversed. Exampl ...

  9. [改善Java代码]不要只替换一个类

    建议20: 不要只替换一个类 我们经常在系统中定义一个常量接口(或常量类),以囊括系统中所涉及的常量,从而简化代码,方便开发,在很多的开源项目中已采用了类似的方法,比如在Struts2中,org.ap ...

  10. Leetcode 190. Reverse Bits(反转比特数)

    Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in ...