Skip to content

Instantly share code, notes, and snippets.

@rjha
Created June 17, 2012 06:35
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rjha/2943725 to your computer and use it in GitHub Desktop.
Save rjha/2943725 to your computer and use it in GitHub Desktop.
Nginx configuration for 503 custom maintenance page
server {
listen 80;
# default catch-all domain
server_name _ ;
error_page 503 @503 ;
#return 503 ;
root /var/www/htdocs/ ;
server_name_in_redirect off;
#rewrite rule for auto versioning
rewrite ^/(css|js)/(.*)\.t([0-9].*)\.(css|js)$ /$1/$2.$4 ;
try_files $uri $uri/ /index.php?q=$uri&$args;
location @503 {
#avoid redirect to built-in 503.
try_files /site/503.html =503;
}
location ~* \.(js|css|png|jpg|jpeg|gif)$ {
expires 30d ;
break ;
}
#pass all requests for php to fastcgi
location ~ \.php$ {
try_files $uri =404;
#change port on local m/c.
fastcgi_read_timeout 600 ;
fastcgi_pass 127.0.0.1:9100 ;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment