server { listen 8080 default_server; root /usr/share/nginx/html/; 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 /api { rewrite ^/api/(.*) /$1 break; proxy_pass http://json-server:3000/api; } }