upstream app { server app:8080; } server { listen 80; root /usr/share/nginx/html; location / { index index.html index.htm; try_files $uri $uri/ /index.html; } location /api { rewrite /api/(.*) /$1 break; proxy_pass http://app; } }