Jan 13, 2017, 11:55

How to expose internal website via nginx-proxy

For instance you have several small-sized dockerized websited on different servers in your internal network with webserver's IP like,, and you would like to expose your site to public via single IP address like

Is that possible? Sure, and you can even use great jwilder/nginx-proxy image for that.

Just create on public webserver folder /home/user/conf.d/external.conf and put there config like this

log_format vhost '$host $remote_addr - $remote_user [$time_local] '
                 '"$request" $status $body_bytes_sent '
                 '"$http_referer" "$http_user_agent"';
upstream server.it-premium.com.ua {
server {
  server_name server.it-premium.com.ua;
  listen 80;
  location / {
    proxy_pass http://server.it-premium.com.ua;
  access_log /var/log/nginx/access.log vhost;

also launch nginx-proxy container with extra arguments

-v /home/user/conf.d/external.conf:/etc/nginx/conf.d/external.conf

that will connect single config file to nginx config folder and will read configuration from there.
Beware, in case you change manually external.conf you'll need to restart your nginx container, because docker will treat your file as invalid.