Could not reliably determine the server's fully qualified domain name … How to solve it in Docker?

后端 未结 3 1304
感动是毒
感动是毒 2021-01-31 16:48

I am just starting in Docker and I was following that tutorial that shows basically these steps:

  1. Create a Dockerfile like this:

    From php:7.0-apach

3条回答
  •  星月不相逢
    2021-01-31 17:33

    This is not an error it is just a warning and you can safely ignore it. What it is saying is that ServerName is not set so it will assume machine IP as the same.

    If you look at the default configs present inside /etc/apache2/sites-available, you will find 000-default.conf and default-ssl.conf

    root@d591ab6febff:/etc/apache2/sites-available# cat 000-default.conf
    
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com
    
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html
    
        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn
    
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
    
        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
    
    

    The ServerName directive is commented in the config

    #ServerName www.example.com
    

    So if you are worried about the warning you should change it to the value you want like below

    ServerName www.tarunlalwani.com
    ServerAlias tarunlalwani.com
    

    You would need to create a config in your folder and then overwrite the files from default config using Dockerfile. Then the warning would be gone.

提交回复
热议问题