server { listen 80; server_name localhost; gzip on; gzip_min_length 1k; gzip_comp_level 9; gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png; gzip_vary on; gzip_disable "MSIE [1-6]\."; location / { root /usr/share/nginx/html; index index.html index.htm; try_files $uri $uri/ @router; error_page 405 =200 http://$host$request_uri; } location @router { rewrite ^.*$ /index.html last; } location /api { proxy_pass http://CONTAINER-HOST:82; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REMOTE-HOST $remote_addr; add_header X-Cache $upstream_cache_status; #Set Nginx Cache rewrite ^/api/(.*)$ /$1 break; add_header Cache-Control no-cache; expires 12h; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } }