Skip to content

Instantly share code, notes, and snippets.

@michael34435
Created September 26, 2018 01:49
Show Gist options
  • Save michael34435/e83fda8ed43db172d216f0635ac0fbdd to your computer and use it in GitHub Desktop.
Save michael34435/e83fda8ed43db172d216f0635ac0fbdd to your computer and use it in GitHub Desktop.
server {
listen 80 default_server;
listen [::]:80 default_server;
server_tokens off;
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_set_header X-NginX-Proxy true;
root /usr/share/nginx/html;
location /api/ {
rewrite ^/api/(.*) /$1 break;
proxy_connect_timeout 600;
proxy_read_timeout 600;
proxy_pass http://api:3000;
}
location / {
try_files $uri $uri/ @rewrites;
}
location @rewrites {
rewrite ^(.+)$ /index.html last;
}
location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
# Some basic cache-control for static files to be sent to the browser
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment