而微软 发表于 2015-11-19 09:39:37

docker centos7 httpd的小坑

我的寄主机是centos6.73.10的内核今天下了个镜像做docker docker容器竟然是centos7我也是醉了

这里说下在apache简单配置里面的坑, 由于是验证没有较多的配置 只是想实现echo hello的效果

apache是yum安装的   完事没有发现/etc/init.d/httpd脚本 也是 7都改版了可是
systemctl start httpd.service也是不好用的
我发现安装了个命令 httpd在/usr/sbin 下

执行httpd报错
# 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 !$


然后执行报错:
# 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
访问成功


wangtenghe 发表于 2015-11-19 14:17:37

谁给你的脸啊粘贴不带改一个字的
页: [1]
查看完整版本: docker centos7 httpd的小坑