Skip to content

Instantly share code, notes, and snippets.

@he9lin
Forked from JakubOboza/gist:2008958
Created March 17, 2012 02:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save he9lin/2054587 to your computer and use it in GitHub Desktop.
Save he9lin/2054587 to your computer and use it in GitHub Desktop.
faye as subdomain
upstream faye {
server 127.0.0.1:9292;
}
upstream webrick{
server 127.0.0.1:3000;
}
server {
listen 80 default;
server_name faye.app.local;
root /Users/kuba/Workspace/Ruby/app_training;
access_log /var/log/nginx/faye.app.access.log;
location / {
proxy_pass http://faye;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 80;
server_name app.local;
root /Users/kuba/Workspace/Ruby/app_training;
access_log /var/log/nginx/faye.app.access.log;
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_redirect off;
if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html break;
}
if (-f $request_filename.html) {
rewrite (.*) $1.html break;
}
if (!-f $request_filename) {
proxy_pass http://webrick;
break;
}
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment