Skip to content

Instantly share code, notes, and snippets.

@imran-vz
Last active April 7, 2021 18:35
Show Gist options
  • Save imran-vz/d44fe681d0e92d0bb04ca966e1ba616e to your computer and use it in GitHub Desktop.
Save imran-vz/d44fe681d0e92d0bb04ca966e1ba616e to your computer and use it in GitHub Desktop.
server {
listen 80 default_server;
server_name _;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 0;
gzip_types text/plain application/javascript text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype;
# react app & front-end files
location / {
root /var/www/{MY_FOLDER};
try_files $uri /index.html;
}
# node api reverse proxy
location /api/ {
proxy_pass http://localhost:{PORT}/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment