Skip to content

Instantly share code, notes, and snippets.

@bryanforbes
Created May 19, 2011 18:13
Show Gist options
  • Select an option

  • Save bryanforbes/981378 to your computer and use it in GitHub Desktop.

Select an option

Save bryanforbes/981378 to your computer and use it in GitHub Desktop.
Nginx Proxy
server {
listen 80;
server_name project.local;
root /path/to/project;
access_log /var/log/nginx/project.local.access.log;
error_log /var/log/nginx/project.local.error.log;
location / {
index index.html;
autoindex on;
}
location /service {
if ($request_uri ~ ^/service(.*)) {
set $encoded $1;
}
rewrite ^$encoded? break;
proxy_pass http://example.com:10000;
proxy_set_header X-Real-IP $remote_addr;
}
location /other_service/ {
rewrite /other_service/(.*) /$1 break;
proxy_pass http://example.com:10001;
proxy_set_header X-Real-IP $remote_addr;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment