Created
July 10, 2014 14:57
-
-
Save jcasadella/e557fd43ed3caf66c9d5 to your computer and use it in GitHub Desktop.
Nginx 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
user www-data; | |
worker_processes 1; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
# include mime.types; | |
default_type application/octet-stream; | |
sendfile on; | |
keepalive_timeout 65; | |
server { | |
listen 1020; | |
server_name localhost; | |
location / { | |
root /home/jcasadella/source/example/build; | |
index index.html index.htm; | |
} | |
location /url1/ { | |
proxy_pass http://localhost:8081/url1/; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header Host $http_host; | |
proxy_cookie_domain ~\.* localhost:8081; | |
proxy_cookie_path /url1/ /; | |
} | |
location /url2/ { | |
proxy_pass http://localhost:8080/url2/; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header Host $http_host; | |
proxy_cookie_domain ~\.* localhost:8085; | |
proxy_cookie_path /url2/ /; | |
} | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html { | |
root /usr/share/nginx/www; | |
} | |
} | |
} |
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
#!/bin/bash | |
DEFAULT='nginx' | |
if test -z $1 | |
then ENV=$DEFAULT | |
else ENV=$1 | |
fi | |
CONFIG_FILE=$HOME/.nginx/$ENV.conf | |
sudo nginx -c $CONFIG_FILE | |
cat $CONFIG_FILE | grep listen | sed 's/[ ]*//' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment