Skip to content

Instantly share code, notes, and snippets.

@batuzav
Last active November 10, 2020 23:23
Show Gist options
  • Save batuzav/6b01e3b630d18ad89b00e6dec923910b to your computer and use it in GitHub Desktop.
Save batuzav/6b01e3b630d18ad89b00e6dec923910b to your computer and use it in GitHub Desktop.
Nginx config to NodeJS

server { listen 80; server_name blnews.com www.blnews.com;

#Configures the publicly served root directory
#Configures the index file to be served
root /var/www/proyectos/mybl-news-backend;
    index index.html index.htm;

#These lines create a bypass for certain pathnames
#www.example.com/test.js is now routed to port 3000
#instead of port 80
location / {
    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;
    proxy_cache_bypass $http_upgrade;
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment