Skip to content

Instantly share code, notes, and snippets.

@mlc
Created December 30, 2010 20:21
Show Gist options
  • Save mlc/760245 to your computer and use it in GitHub Desktop.
Save mlc/760245 to your computer and use it in GitHub Desktop.
sample nginx config for proxying rails.
upstream thin {
server 127.0.0.1:9000;
server 127.0.0.1:9001;
server 127.0.0.1:9002;
}
server {
listen 80;
server_name pbcore.vermicel.li;
access_log /var/log/nginx/pbcore.access.log;
root /var/www/pbcore/current/public;
if (-f /var/www/pbcore/shared/system/maintenance.html) {
rewrite ^(.*)$ /system/maintenance.html last;
break;
}
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 false;
proxy_max_temp_file_size 0;
if (!-f $request_filename) {
proxy_pass http://thin;
break;
}
}
error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment