Skip to content

Instantly share code, notes, and snippets.

@ulfklose
Created February 7, 2010 21:15
Show Gist options
  • Save ulfklose/297681 to your computer and use it in GitHub Desktop.
Save ulfklose/297681 to your computer and use it in GitHub Desktop.
upstream railsapp {
server unix:/var/run/thin/railsapp.0.sock;
server unix:/var/run/thin/railsapp.1.sock;
}
server {
listen 80;
server_name railsapp.domain.tld;
access_log /var/www/railsapp/log/access.log;
error_log /var/www/railsapp/log/error.log;
root /var/www/railsapp/public/;
index index.html;
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://railsapp;
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment