upstream ruby_china_backend {
# This is the socket we configured in unicorn.rb
server unix:///data/www/ruby-china/shared/tmp/sockets/puma.sock fail_timeout=0;
keepalive 3;
}
server {
listen 80;
server_name ftghub.com;
root /www/ruby-china/current/public;
gzip_static on; #to serve pre-gzipped version
if (-f $document_root/system/maintenance.html) {
rewrite ^(.*)$ /system/maintenance.html break;
}
location ~ (/assets|/system|/avatar.png|/favicon.ico|/*.txt) {
access_log off;
expires 14d;
gzip_static on;
add_header Cache-Control public;
}
location / {
if ($host != 'ftghub.com') {
rewrite ^/(.*)$ http://ftghub/$1 permanent;
}
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_buffering on;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header X-Forwarded-Proto https;
proxy_pass http://ruby_china_backend;
gzip on;
}
error_page 500 502 503 504 /500.html;
location = /500.html {
root /www/ruby-china/current/public;
}
}
|