Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
upstream thin_cluster {
server unix:/tmp/thin.blog.0.sock;
server unix:/tmp/thin.blog.1.sock;
}
server {
listen 80;
server_name blog.example.com;
root /var/www/sites/blog/current/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_cluster;
break;
}
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 80;
server_name files.example.com;
# auto file listing
autoindex on;
location / {
root /var/www/sites/files/;
index index.html index.htm;
}
}
user www-data;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
sendfile on;
keepalive_timeout 65;
#gzip on;
# default server
server {
listen 80;
server_name example.com www.example.com;
location / {
root /var/www/domain/;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
include /usr/local/nginx/conf/vhosts/*;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment