1. 程式人生 > >從官網上下來的httpd Docker映象,無法正常啟動,執行出現AH00558錯誤:

從官網上下來的httpd Docker映象,無法正常啟動,執行出現AH00558錯誤:

從官網上下來的httpd映象,執行出現AH00558錯誤:

   [[email protected] apache2_image]# docker run -it --rm  httpd
    AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.24. Set the 'ServerName' directive globally to suppress this message
    AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.24. Set the 'ServerName' directive globally to suppress this message
    [Thu Jan 03 07:58:52.354697 2019] [mpm_event:notice] [pid 1:tid 140595899299008] AH00489: Apache/2.4.37 (Unix) configured -- resuming normal operations
    [Thu Jan 03 07:58:52.354827 2019] [core:notice] [pid 1:tid 140595899299008] AH00094: Command line: 'httpd -D FOREGROUND'
    [Thu Jan 03 07:58:52.367200 2019] [mpm_event:notice] [pid 1:tid 140595899299008] AH00492: caught SIGWINCH, shutting down gracefully

首先,用vim開啟apache的配置檔案(根據個人情況來找到配置檔案,centos的系統預設在/etc/httpd/conf/httpd.conf,但我下的httpd標準映象在/usr/local/apache2/conf/httpd.conf)
然後,使用vim的/搜尋命令,搜尋ServerName關鍵字
使用vim的yy命令複製上圖所示的行,按p鍵貼上,然後去掉開頭的#號,將www.example.com替換為localhost,
設定完成後,wq!命令退出vim,再次檢查apache配置,就不會再有這個錯誤提示了。

如果是寫在Dockerfile檔案裡,則是:
RUN sed -i ‘s/#ServerName

www.example.com:80/ServerName localhost:80/g’ /usr/local/apache2/conf/httpd.conf