docker centos7 httpd的小坑
2015-11-18 11:57
1176 查看
我的寄主机是centos6.7 3.10的内核 今天下了个镜像做docker docker容器竟然是centos7 我也是醉了
这里说下在apache简单配置里面的坑 , 由于是验证没有较多的配置 只是想实现echo hello的效果
apache是yum安装的 完事没有发现/etc/init.d/httpd脚本 也是 7都改版了 可是
systemctl start httpd.service也是不好用的
我发现安装了个命令 httpd 在/usr/sbin 下
执行httpd 报错
[root@d9706c29a233 /]# httpd
AH00526: Syntax error on line 119 of /etc/httpd/conf/httpd.conf:
DocumentRoot must be a directory
119行是 DocumentRoot "/var/www/html" 没有路径
解决办法
mkdir -p /var/www/html
chown apache:apache !$
然后执行报错:
[root@d9706c29a233 /]# httpd
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.6. Set the 'ServerName' directive globally to suppress this message
(2)No such file or directory: AH02291: Cannot access directory '/etc/httpd/logs/' for main error log
AH00014: Configuration check failed
大概意思是servername不对 和 没有路径 /etc/httpd/logs
把 #ServerName www.example.com:80 修改为 ServerName localhost:80
sed -i 's@#ServerName www.example.com@ServerName localhost@' /etc/httpd/conf/httpd.conf
/etc/httpd/logs -> /var/log/httpd 软连接 只需要创建/var/log/httpd 就可以了
mkdir /var/log/httpd
chown apache:apache !$
echo 'hello' > /var/www/html/index.html
再次启动
httpd
curl 127.0.0.1
访问成功
本文出自 “新人一个” 博客,谢绝转载!
这里说下在apache简单配置里面的坑 , 由于是验证没有较多的配置 只是想实现echo hello的效果
apache是yum安装的 完事没有发现/etc/init.d/httpd脚本 也是 7都改版了 可是
systemctl start httpd.service也是不好用的
我发现安装了个命令 httpd 在/usr/sbin 下
执行httpd 报错
[root@d9706c29a233 /]# httpd
AH00526: Syntax error on line 119 of /etc/httpd/conf/httpd.conf:
DocumentRoot must be a directory
119行是 DocumentRoot "/var/www/html" 没有路径
解决办法
mkdir -p /var/www/html
chown apache:apache !$
然后执行报错:
[root@d9706c29a233 /]# httpd
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.6. Set the 'ServerName' directive globally to suppress this message
(2)No such file or directory: AH02291: Cannot access directory '/etc/httpd/logs/' for main error log
AH00014: Configuration check failed
大概意思是servername不对 和 没有路径 /etc/httpd/logs
把 #ServerName www.example.com:80 修改为 ServerName localhost:80
sed -i 's@#ServerName www.example.com@ServerName localhost@' /etc/httpd/conf/httpd.conf
/etc/httpd/logs -> /var/log/httpd 软连接 只需要创建/var/log/httpd 就可以了
mkdir /var/log/httpd
chown apache:apache !$
echo 'hello' > /var/www/html/index.html
再次启动
httpd
curl 127.0.0.1
访问成功
本文出自 “新人一个” 博客,谢绝转载!
相关文章推荐
- Docker WordPress 调试
- 使用influxdb+cadvisor+grafana的docker镜像搭建一个实时监控系统的环境
- Docker(六):容器
- mesos + marathon + docker部署
- Docker(五):镜像
- docker基础学习
- docker index服务概述
- docker index服务概述
- docker index服务概述
- Docker实战(五):Docker安装Tomcat
- Docker实战(四):Docker安装JDK
- Docker实战(三):Docker安装ssh,supervisor等基础工具
- Docker实战(二):制作自己的Docker镜像
- 1.0.4、Docker Swarm
- 1.0.2、Docker Machine
- Docker实战(一):Docker基础命令
- Libcompose 与畅游 Docker Compose
- [置顶] Docker镜像与容器命令
- 1.0.3Docker Compose
- Lvs下使用Docker扩容实验