upstream pushgateway { server p_gw:9091; } server { listen 0.0.0.0:9091; server_name __; location / { auth_basic "Pushgateway server authentication"; auth_basic_user_file /etc/nginx/.htpasswd; proxy_pass http://pushgateway; } }