upstream ponzu { server admin:8080; } server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /public; index index.html index.htm; location ~ /api(.*)$ { try_files $uri @ponzu; } location ~ /admin(.*)$ { try_files $uri @ponzu; } location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ /index.html; } location @ponzu { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; proxy_pass http://ponzu; } }