Skip to content

Instantly share code, notes, and snippets.

@fuse
Created November 15, 2011 10:59
Show Gist options
  • Save fuse/1366787 to your computer and use it in GitHub Desktop.
Save fuse/1366787 to your computer and use it in GitHub Desktop.
server {
listen 80;
server_name fake.server;
access_log /var/log/nginx/fake.access.log;
error_log /var/log/nginx/fake.error.log;
# direct to maintenance if this file exists
if (-f $document_root/system/maintenance.html) {
rewrite ^(.*)$ /system/maintenance.html last;
break;
}
location / {
root /www/fake/current/public;
proxy_redirect http://fake/ /;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# If the file exists as a static file serve it directly
if (-f $request_filename) {
break;
}
if (!-f $request_filename) {
proxy_pass http://fake;
break;
}
}
error_page 500 502 503 504 /500.html;
location = /500.html {
root /www/fake/current/public;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment