From the docs [1]:
In catch-all server examples the strange name “_” can be seen:
server {
listen 80 default_server;
server_name _;
return 444;
}
There is nothing special about this name, it is just one of a myriad
of invalid domain names which never intersect with any real name.
Still, an invalid domain name makes more sense than 'localhost' for a
public server.
[1]: http://nginx.org/en/docs/http/server_names.html#miscellaneous_names
RUN rc-update add nginx default
RUN sed -i 's/listen 127.0.0.1;/listen 80 default_server;/' /etc/nginx/nginx.conf
+RUN sed -i 's/server_name localhost;/server_name _;/' /etc/nginx/nginx.conf
RUN mkdir /var/www/localhost/htdocs
# Container networking happens automatically