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 *: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>
方法三:配置虚拟主机时,不开启虚拟主机的配置文件,自己新建配置文件;
#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即可。
相关文章
- Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/maven/cli/MavenCli : Unsupported major.minor version 51.0
- Apache-Axis小结
- apache 重点难点
- Apache信息头
- 使用Apache模块mod_deflate加快页面打开速度
- 大叔问题定位分享(10)提交spark任务偶尔报错 org.apache.spark.SparkException: A master URL must be set in your configuration
- 修改Apache默认端口
- Linux Apache服务详解——Apache虚拟目录与禁止显示目录列表实战
- Apache几种限制ip的方法
- Apache httpclient的execute方法调试
- Atitit spring原理 反射 ioc 与注解api 目录 1. 反射的使用1 1.1. 使用jdk原生反射api1 1.2. 使用apache 工具包 commons-beanutil
- 关于Apache Commons-Lang3的使用
- java.net.ConnectException: Call From slaver1/192.168.19.128 to slaver1:8020 failed on connection exception: java.net.ConnectException: Connection refused; For more details see: http://wiki.apache.org
- 【Apache Spark 】第 11 章使用 Apache Spark 管理、部署和扩展机器学习管道
- Apache Kafka 基础