Apache重启报警,不存在虚拟主机目录(httpd.conf打开了一些扩展)
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打开了一些扩展)的更多相关文章
- Apache 创建虚拟主机目录和设置默认访问页面
虚拟主机 (Virtual Host) 是在同一台机器搭建属于不同域名或者基于不同 IP 的多个网站服务的技术. 可以为运行在同一物理机器上的各个网站指配不同的 IP 和端口, 也可让多个网站拥有不同 ...
- 在Apache中利用ServerAlias设置虚拟主机接收多个域名和设置域名泛解析
ServerAlias:服务器别名,在Apache中可以用于设置虚拟主机接收到个域名,也可以用于接收泛解析的域名.具体的设置方法如下: 一.用于设置虚拟主机接收多个域名 一个虚拟主机常常会接收多个域名 ...
- apache 多端口配置和虚拟主机配置
1 打开httpd.conf文件 2 添加端口监听 (找到Lisen 80 在后面添加 Listen 端口号 如Listen 1112) port =>你的端口 project_name=> ...
- 本地机apache配置基于域名的虚拟主机详解
1.打开apache的httpd.conf文件,找到# Virtual hosts#Include conf/extra/httpd-vhosts.conf这一段把Include conf/extra ...
- apache WEB服务器安装(包括虚拟主机)
一.apache下载编译安装 yum install apr apr-devel apr-util apr-util-devel gcc-c++ wget tar -y cd /usr/src wge ...
- 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 ...
- apache配置文件详解及虚拟主机的搭建
1.404跳转: <IfModule dir_module> DirectoryIndex index.php index.html /error.php</IfModule& ...
- Apache设置二级域名和虚拟主机
apache httpd.conf 最后: ------------------------------NameVirtualHost *:80<VirtualHost *:80> ...
- Apache 配置多端口 多虚拟主机 局域网访问
\wamp\bin\apache\Apache2.4.4\conf\extra\httpd-vhosts.conf 修改如下 NameVirtualHost *:80 Documen ...
随机推荐
- js:对象的创建(为prototype做铺垫)
/** *在js中并不存在类,所以能够直接通过Object来创建对象,可是使用这样的方式创建有一 *弊端:因为没有类的约束,无法实现对象的反复利用,而且没有一种规范约定,在操作时easy带来问题. ...
- monkey源代码分析之事件注入方法变化
在上一篇文章<Monkey源代码分析之事件注入>中.我们看到了monkey在注入事件的时候用到了<Monkey源代码分析番外篇之Android注入事件的三种方法比較>中的第一种 ...
- Openshift 3.11和LDAP的集成
1. OpenLDAP的安装 只记录主要步骤,详细可参考 https://access.redhat.com/solutions/2484371 # yum install -y openldap o ...
- 用IIS防止mdb数据库被下载
如何防止mdb数据库被下载?本文讨论的是在服务器端禁止mdb格式数据库文件被下载,而不是在数据库中加入防下载表,将数据库名改为含#号的asp.asa等后缀格式. 下面以IIS6.0为例说明如何在服务器 ...
- js版根据经纬度计算多边形面积(墨卡托投影)
[摘要:var earthRadiusMeters = 6371000.0; var metersPerDegree = 2.0 * Math.PI * earthRadiusMeters / 360 ...
- PHP防抓取数据curl 解决方法
1.使用Snoopy或curl传搜索引擎爬虫的USERAGENT值. 查看搜索引擎爬虫的USERAGENT值:http://www.cnblogs.com/grimm/p/5068092.html ( ...
- windows下读取Linux分区软件
导读 ext3等日志型文件系统是Linux中被广泛应用的,通常是许多流行Linux发行版默认的文件系统.etx4也是Linux下的日志型文件系统,被设计作为ext3的继任者.他消除了64位存储限制,是 ...
- spring mvc--默认都使用了哪些bean
在MVC中默认使用的bean都定义在了 org.springframework.web.servlet下的DispatcherServlet.properties 下载源文件后可查看到默认bean定义 ...
- (剑指Offer)面试题42:左旋转字符串
题目: 字符串的左旋转操作是把字符串前面的若干字符转移到字符串的后面.请定义一个函数实现字符串左旋转操作的功能, 比如:输入字符串"abcdefg"和数字2,该函数将返回左旋转2位 ...
- mysql查找数据库中是否已经存在某张表
Sql: select count(*) from information_schema.TABLES t where t.TABLE_SCHEMA ="数据库名" and t.T ...