Created
March 8, 2019 11:50
-
-
Save lenconda/98e182ce923d5fa0764319d9d31ded0a to your computer and use it in GitHub Desktop.
Nginx config file to make a Node.js backend proxy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# © 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