Skip to content

Instantly share code, notes, and snippets.

@yusufnb
Created January 16, 2020 02:56
Show Gist options
  • Save yusufnb/ccaf962bafd3f6b98b2e35eb6e6609a1 to your computer and use it in GitHub Desktop.
Save yusufnb/ccaf962bafd3f6b98b2e35eb6e6609a1 to your computer and use it in GitHub Desktop.

Revisions

  1. yusufnb created this gist Jan 16, 2020.
    34 changes: 34 additions & 0 deletions Nginx proxy for frontend backend apps
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    worker_processes 1;
    events {
    worker_connections 1024;
    }
    http {
    send_timeout 1800;
    sendfile on;
    keepalive_timeout 6500;
    server {
    listen 80;
    server_name localhost;
    location / {
    proxy_pass http://localhost:3000;
    proxy_set_header Host $host;
    }
    # for CRA apps that auto load on change
    location /sockjs-node {
    proxy_pass http://localhost:3000;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $host;
    }
    location /api {
    proxy_pass http://localhost:8080;
    proxy_set_header Host $host;
    }
    location /auth {
    proxy_pass http://localhost:8080;
    proxy_set_header Host $host;
    }

    }
    }