Skip to content

Instantly share code, notes, and snippets.

@xlab
Created December 10, 2012 21:23
Show Gist options
  • Save xlab/4253536 to your computer and use it in GitHub Desktop.
Save xlab/4253536 to your computer and use it in GitHub Desktop.
Nginx + Thin config
upstream thin {
server unix:/tmp/thin.0.sock;
server unix:/tmp/thin.1.sock;
}
server {
listen 80;
server_name domain.ru;
root /var/www/domain/public;
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://thin;
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