Apache重启时报警:

AH00112: Warning: DocumentRoot [/usr/local/apache/docs/dummy-host.example.com] does not exist

AH00112: Warning: DocumentRoot [/usr/local/apache/docs/dummy-host2.example.com] does not exist

问题原因:

Apache在配置虚拟主机时会在配置文件中(httpd.conf)开启虚拟主机的配置文件;

将“ #Include /etc/httpd/extra/httpd-vhosts.conf ”前面的“#”去掉;

而“httpd-vhosts.conf ”中会有两个配置虚拟主机的例子:

<VirtualHost *:80>
   ServerAdmin webmaster@dummy-host.example.com
   DocumentRoot "/usr/local/apache/docs/dummy-host.example.com"
   ServerName dummy-host.example.com
   ServerAlias www.dummy-host.example.com
   ErrorLog "logs/dummy-host.example.com-error_log"
   CustomLog "logs/dummy-host.example.com-access_log" common
</VirtualHost>

<VirtualHost *:80>
   ServerAdmin webmaster@dummy-host2.example.com
   DocumentRoot "/usr/local/apache/docs/dummy-host2.example.com"
   ServerName dummy-host2.example.com
   ErrorLog "logs/dummy-host2.example.com-error_log"
   CustomLog "logs/dummy-host2.example.com-access_log" common
</VirtualHost>

这样Apache在启动时就会去寻找以上两个不存在的文件夹,就会报错。

解决方法:

方法一:新建出不存在的文件夹;

  #cd /usr/local/apache

  #mkdir -p docs/dummy-host2.example.com  #这里是新建文件夹

  #mkdir -p docs/dummy-host.example.com

方法二:将“httpd-vhosts.conf ”中的例子注释掉;

  #<VirtualHost *:>
  #    ServerAdmin webmaster@dummy-host2.example.com
  #    DocumentRoot "/usr/local/apache/docs/dummy-host2.example.com"
  #    ServerName dummy-host2.example.com
  #   ErrorLog "logs/dummy-host2.example.com-error_log"
  #    CustomLog "logs/dummy-host2.example.com-access_log" common
  #</VirtualHost>

方法三:配置虚拟主机时,不开启虚拟主机的配置文件,自己新建配置文件;

#vim /etc/httpd/httpd.conf

#Include /etc/httpd/extra/httpd-vhosts.conf

  Incloud /etc/httpd/extra/XXX.conf  #新建的配置文件一定要与“httpd-vhosts.conf”放在同一个文件夹内

  Incloud /etc/httpd/extra/XXX.conf  #文件名称可以自己定义

更改完成之后重启Apache即可。

Apache重启报警,不存在虚拟主机目录(httpd.conf打开了一些扩展)的更多相关文章

  1. Apache 创建虚拟主机目录和设置默认访问页面

    虚拟主机 (Virtual Host) 是在同一台机器搭建属于不同域名或者基于不同 IP 的多个网站服务的技术. 可以为运行在同一物理机器上的各个网站指配不同的 IP 和端口, 也可让多个网站拥有不同 ...

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

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

  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 WEB服务器安装(包括虚拟主机)

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

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

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

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

  8. Apache设置二级域名和虚拟主机

    apache  httpd.conf 最后: ------------------------------NameVirtualHost *:80<VirtualHost *:80>    ...

  9. Apache 配置多端口 多虚拟主机 局域网访问

    \wamp\bin\apache\Apache2.4.4\conf\extra\httpd-vhosts.conf 修改如下 NameVirtualHost *:80          Documen ...

随机推荐

  1. LINUX开启允许对外访问的网络端口命令

    LINUX通过下面的命令可以开启允许对外访问的网络端口: /sbin/iptables -I INPUT -p tcp --dport 8000 -j ACCEPT #开启8000端口 /etc/rc ...

  2. 自定义ListView adapter适配器

    转自:http://hilary3113.iteye.com/blog/998352 listview加载adapter过程是这样的. 1 先判断adapter 有多少数据项,根据这个数据确定有多少i ...

  3. (转)SqlServer里DateTime转字符串

    原文:http://www.cnblogs.com/kimbosung/p/4515670.html ), )::: ), ): :::953PM ), ): ), ): ), ): ), ): :: ...

  4. [Linux] git send-email的使用

    1. git send-email is included in an individual package, named "git-email":$ sudo apt-get i ...

  5. 1644 免费馅饼 题解(c++)

    1644 免费馅饼(巴蜀oj上的编号) 题面:          SERKOI最新推出了一种叫做"免费馅饼"的游戏.         游戏在一个舞台上进行.舞台的宽度为W格,天幕的 ...

  6. 科普:UTF-8 GBK UTF8 GB2312 之间的区别和关系

    UTF-8:Unicode TransformationFormat-8bit,允许含BOM,但通常不含BOM.是用以解决国际上字符的一种多字节编码,它对英文使用8位(即一个字节),中文使用24为(三 ...

  7. C#常见算法题目

        //冒泡排序    public class bubblesorter    {        public void sort(int[] list)        {            ...

  8. C#中使用TCP通信

    TCP通信需要通信双方都在线,所以需要先启动服务端进行监听,客户端才能获得连接,服务端代码: static void Main(string[] args) { TcpClient client = ...

  9. Android批量图片加载经典系列——Volley框架实现多布局的新闻列表

    一.问题描述 Volley是Google 2013年发布的实现Android平台上的网络通信库,主要提供网络通信和图片下载的解决方案,比如以前从网上下载图片的步骤可能是这样的流程: 在ListAdap ...

  10. ckeditor 实现图片上传以及预览(亲测有效)

    引用ckeditor <script type="text/javascript" src="static/ckeditor/ckeditor.js"&g ...