upstream empact { server 127.0.0.1:8080 max_fails=3 fail_timeout=30s; } server { listen 80 default_server; root /home/empact/app/static; charset utf-8; location / { index hello.html; } location ~ ^/app/ { rewrite ^/app/(.*) /app.html last; } location ~ ^/(auth|api)/ { proxy_pass http://empact; } location ~ .*\.(js|css|png)$ { add_header Cache-Control public; expires max; gzip_static on; gzip on; gzip_proxied any; gzip_vary on; } }