Maintenance Page

trm asn trm.nagios at gmail.com
Fri Mar 30 18:53:43 UTC 2012


Dear List,

I am looking for a maintenance page while working on the upstream Tomcat
server. Below is my nginx.conf file. Is there anything wrong in this config
, as it's not redirecting to the maintenance.html page.


#######################################################################
# This is the main Nginx configuration file.
#######################################################################
user     www-server;
pid logs/nginx.pid;
worker_processes  8;

error_log  /usr/local/nginx/logs/error.log;
#----------------------------------------------------------------------
# Events Module
#----------------------------------------------------------------------
events {
    worker_connections  1024;
}
#----------------------------------------------------------------------
# HTTP Core Module
#----------------------------------------------------------------------
http {
    include       /usr/local/nginx/conf/mime.types;
    default_type  application/octet-stream;

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

    access_log  /usr/local/nginx/logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;
        upstream backend {
        #    ip_hash;
            server 192.168.65.102:8080 srun_id=a;
            #server 192.168.65.103:8080;
            jvm_route $cookie_JSESSIONID reverse;
        }
    server {
        listen       80;
        server_name report-int.example.com;
        root    /var/www/example.com/;

        location / {
                if (-f $document_root/maintenance.html) {
                return 503;
          }
            proxy_pass         http://backend;
            proxy_redirect     off;
            proxy_set_header   Host             $host;
            proxy_set_header   X-Real-IP        $remote_addr;
            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
            client_max_body_size       10m;
            client_body_buffer_size    128k;
            proxy_connect_timeout      90;
            proxy_send_timeout         90;
            proxy_read_timeout         90;
            proxy_buffer_size          4k;
            proxy_buffers              4 32k;
            proxy_busy_buffers_size    64k;
            proxy_temp_file_write_size 64k;
        }
        error_page 503 @maintenance;
        location @maintenance {
        rewrite ^(.*)$ /maintenance.html break;
        }
        error_page  404              /404.html;
        location = /404.html {
            root   /usr/local/nginx/html;
        }
        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/local/nginx/html;
        }
    }
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20120331/90258b16/attachment.html>


More information about the nginx mailing list