Docker PHP-APACHE 容器全局设置 ServerName 指令
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/48868357/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Docker PHP-APACHE container set the ServerName directive globally
提问by Zenzamy Othmane
I get this warning when i try to run my php:apache container on docker please any idea how to solve this.
当我尝试在 docker 上运行我的 php:apache 容器时收到此警告,请知道如何解决此问题。
AH00558: apache2: Could not reliably determine the server's fully
qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message [Mon Feb 19 14:18:21.041074 2018] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.10 (Debian) PHP/7.0.27 configured -- resuming normal operations [Mon Feb 19 14:18:21.041534 2018] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
AH00558: apache2: 无法可靠地确定服务器的完全
限定域名,使用 172.17.0.2。全局设置“ServerName”指令以抑制此消息 AH00558: apache2: 无法可靠地确定服务器的完全限定域名,使用 172.17.0.2。全局设置“ServerName”指令以抑制此消息 [Mon Feb 19 14:18:21.041074 2018] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.10 (Debian) PHP/7.0.27 已配置 -- 正在恢复正常操作 [Mon Feb 19 14:18:21.041534 2018] [core:notice] [pid 1] AH00094:命令行:'apache2 -D FOREGROUND'
DOCKERFILE:
码头档案:
FROM php:7.0-apache
COPY . /var/www/html/
EXPOSE 80
回答by Aserre
Do it like you would do on a regular system:
做它喜欢你会做定期的系统上:
FROM php:7.0-apache
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
COPY . /var/www/html/
EXPOSE 80
You can change the server name to suit your configuration.
您可以更改服务器名称以适合您的配置。
回答by Zenzamy Othmane
Voila thanks to aserre for the help:
瞧,感谢 aserre 的帮助:
DOCKERFILE:
码头档案:
FROM php:7.0-apache
COPY . /var/www/html/
EXPOSE 80
CMD echo "ServerName localhost" >> /etc/apache2/apache2.conf
CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
回答by Armando Valtierra
If you are using Centos as base, it should look like this:
如果您使用 Centos 作为基础,它应该如下所示:
RUN echo "ServerName localhost" >> /etc/httpd/conf/httpd.conf
CMD apachectl -DFOREGROUND
regards
问候