set_real_ip_from 0.0.0.0/0; real_ip_header X-Forwarded-For; log_format upstreamlog '[$time_local] $remote_addr -> $proxy_host:$upstream_addr ' '"$request" $status $body_bytes_sent ' '"$http_referer" "$http_user_agent"'; access_log /var/log/nginx/access.log upstreamlog; upstream back { server back_1:3000; server back_2:3000; } server { listen 80 default_server; listen [::]:80 default_server; server_name _; autoindex off; root /salix/dist; error_page 404 = @notfound; location @notfound { return 302 /; } location ~ ^(/[a-zA-Z0-9_-]+)?/(?api(/.*)?)$ { proxy_pass http://back/$path$is_args$args; } location / { autoindex on; } }