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. 【STL+模拟】UVa 506 - System Dependencies

    System Dependencies  Components of computer systems often have dependencies--other components that m ...

  2. Oracle查询被锁的表及进程的方法

    Oracle查询可以有多种方法,下面为您介绍的是如何Oracle查询被锁的表及Oracle查询连接的进程的方法,希望对您能够有所帮助. 一.查看被锁的表 select p.spid,a.serial# ...

  3. insert 另外一种用法

    then into dept01(id) values(deptno) then into dept02(id) values(deptno) else into dept03(id) values( ...

  4. mysql中文乱码的一点理解

    我们自己鼓捣mysql时,总免不了会遇到这个问题:插入中文字符出现乱码,虽然这是运维先给配好的环境,但是在自己机子上玩的时候咧,总得知道个一二吧,不然以后如何优雅的吹牛B. 如果你也遇到了这个问题,咱 ...

  5. Servlet & JSP - Form-based Authentication

    基本认证和摘要认证都只能使用浏览器自带的登录框而不能使用自定义的登录页面.如果必须使用自定义的登录页面,则可以选择基于表框的认证方式. 基于表框的认证的配置与基本认证和摘要认证的差别在于部署描述符中  ...

  6. Android之图片窗口和大小调节

    结构图: 基类: package ch.halcyon.squareprogressbar.example; import android.app.Activity; import android.a ...

  7. 【Android学习】调用系统短信、电话

    今天全心投入Android学习已经有一段时间了,从起初的啥也不懂,到现在半知半解状态,随笔记录些简单且常用的系统功能代码. 调用Android系统短信,其实调用短信非常简单,一个方法就可以搞定.我们可 ...

  8. ios Swift ! and ?

    swift ?和!之间区别: Swift 引入的最不一样的可能就是 Optional Value 了.在声明时,我们可以通过在类型后面加一个? 来将变量声明为 Optional 的.如果不是 Opti ...

  9. 利用Echarts设计一个图表平台(一)

    Echarts是一款百度的开源图表库,里面提供了非常多的图表样式,我们今天要讲的内容是利用这一款开源js图表,制作一个能够动态定制的图表平台. 1)Echarts API介绍 首先我们先来看一下Ech ...

  10. 全部省市县数据库(MySQL脚本) (转)

    /*MySQL - 5.5.47 *************//*!40101 SET NAMES utf8 */; create table `base_area` (    `codeid` me ...