atom feed21 messages in ru.sysoev.nginxRe: Custom 503 Error Page
FromSent OnAttachments
Douglas A. SeifertFeb 2, 2008 3:18 pm 
Maxim DouninFeb 2, 2008 4:36 pm 
Douglas A. SeifertFeb 2, 2008 5:08 pm 
Maxim DouninFeb 2, 2008 5:20 pm 
Eden LiFeb 2, 2008 5:22 pm 
Douglas A. SeifertFeb 2, 2008 6:14 pm 
Douglas A. SeifertFeb 2, 2008 6:15 pm 
Maxim DouninFeb 2, 2008 6:33 pm 
Eden LiFeb 2, 2008 6:47 pm 
Maxim DouninFeb 2, 2008 7:15 pm 
Douglas A. SeifertFeb 2, 2008 8:02 pm 
Corey DonohoeFeb 2, 2008 10:39 pm 
Igor SysoevFeb 2, 2008 10:40 pm 
Douglas A. SeifertFeb 3, 2008 7:51 am 
Douglas A. SeifertFeb 3, 2008 7:58 am 
Corey DonohoeFeb 3, 2008 9:59 am 
Doug SeifertFeb 3, 2008 1:36 pm 
Killian MurphyJun 19, 2009 9:47 pm 
Spirit SpiritNov 26, 2009 2:31 pm 
Igor SysoevNov 26, 2009 10:02 pm 
spiritDec 2, 2009 1:46 pm 
Subject:Re: Custom 503 Error Page
From:Corey Donohoe (atmo@public.gmane.org)
Date:Feb 3, 2008 9:59:39 am
List:ru.sysoev.nginx

On 2/3/08, Douglas A. Seifert <dseifert-i1+wPaW@public.gmane.org>
wrote:

test.conf

---------------------- # number of nginx workers worker_processes 6;

# pid of nginx master process pid /usr/local/www/nginx.pid;

# Number of worker connections. 1024 is a good default events { worker_connections 1024; }

# start the http module where we config http access. http { # pull in mime-types. You can break out your config # into as many include's as you want to make it cleaner include /usr/local/nginx/conf/mime.types;

# set a default type for the rare situation that # nothing matches from the mimie-type include default_type application/octet-stream;

# configure log format log_format main '$remote_addr - $remote_user [$time_local] ' '"$request" $status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"';

# main access log access_log /usr/local/www/log/nginx_access.log main;

# main error log error_log /usr/local/www/log/nginx_error.log debug;

# no sendfile on OSX sendfile on;

# These are good default values. tcp_nopush on; tcp_nodelay off; # output compression saves bandwidth gzip on; gzip_http_version 1.0; gzip_comp_level 2; gzip_proxied any; gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;

server {

# port to listen on. Can also be set to an IP:PORT listen *:8080;

# Set the max size for file uploads to 50Mb client_max_body_size 50M;

# sets the domain[s] that this vhost server requests for server_name .foo.com *;

# doc root root /usr/local/www/test;

# vhost specific access log access_log /usr/local/www/log/nginx.vhost.access.log main;

# this rewrites all the requests to the maintenance.html # page if it exists in the doc root. This is for capistrano's # disable web task error_page 500 502 504 /500.html; error_page 503 @503; location @503 { rewrite ^(.*)$ /system/maintenance.html break; } location /system/maintenance.html { # pass }

location / { if (-f $document_root/system/maintenance.html) { return 503; } }

Here's my server block. My ordering is slightly different. http://pastie.caboo.se/private/dmnepj3m2zxsnxhrqsuhcq

Here's the shell output from curl before and after the maintenance page goes up, and it appears to be delivering the content as expected. http://pastie.caboo.se/private/rpjtmssmf8jfyblhp4rpfq