Skip to content

Instantly share code, notes, and snippets.

@lenconda
Created March 8, 2019 11:50
Show Gist options
  • Save lenconda/98e182ce923d5fa0764319d9d31ded0a to your computer and use it in GitHub Desktop.
Save lenconda/98e182ce923d5fa0764319d9d31ded0a to your computer and use it in GitHub Desktop.
Nginx config file to make a Node.js backend proxy
# © Lenconda
# When the path is //path.example.com/api/path/to/interface, redirect to http://localhost:3000/api/path/to/interface
# Backend should add a route prefix of '/api'
server {
listen 80;
server_name path.example.com;
location / {
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;
proxy_pass http://localhost:3000;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment