Last active
April 11, 2017 09:53
-
-
Save faberyx/f35eeda11c86783973de2d368e95500a to your computer and use it in GitHub Desktop.
nginx proxy
This file contains 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
# loca | |
upstream app_indico { | |
server 127.0.0.1:3001; | |
} | |
upstream app_thezoo{ | |
server 127.0.0.1:3002; | |
} | |
upstream app_thezoo_server{ | |
server 127.0.0.1:3003; | |
} | |
#Point http requests to https | |
server { | |
listen 0.0.0.0:80; | |
server_name indicodevserver.tk; | |
server_tokens off; | |
return 301 https://$host$request_uri; | |
} | |
# default instance and node | |
server { | |
listen 443 ssl; | |
ssl_certificate /etc/letsencrypt/live/indicodevserver.tk/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/indicodevserver.tk/privkey.pem; | |
server_name indicodevserver.tk; | |
access_log /var/log/nginx/indico.log; | |
error_log /var/log/nginx/indico_error.log; | |
# pass the request to the node.js server with the correct headers and much more can be added, see nginx config options | |
location / { | |
# auth_basic "Restricted"; | |
# auth_basic_user_file /home/ubuntu/app/.htpasswd; | |
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_set_header X-Ssl on; | |
proxy_pass http://app_indico; | |
proxy_redirect off; | |
} | |
} | |
# thezoo instance | |
server { | |
listen 443 ssl; | |
ssl_certificate /etc/letsencrypt/live/thezoodevserver.tk/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/thezoodevserver.tk/privkey.pem; | |
server_name thezoodevserver.tk; | |
access_log /var/log/nginx/thezoo.log; | |
error_log /var/log/nginx/thezoo_error.log; | |
# pass the request to the node.js server with the correct headers and much more can be added, see nginx config options | |
location / { | |
# auth_basic "Restricted"; | |
# auth_basic_user_file /home/ubuntu/app/.htpasswd; | |
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_set_header X-Ssl on; | |
proxy_pass http://app_thezoo; | |
proxy_redirect off; | |
} | |
location /server/ { | |
rewrite /server/(.*)$ /$1 break; | |
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_set_header X-Ssl on; | |
proxy_pass http://app_thezoo_server; | |
proxy_redirect off; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment