Dear List,<div><br></div><div>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.</div>
<div><br><div><br></div><div><div><font size="1">#######################################################################</font></div><div><font size="1"># This is the main Nginx configuration file.</font></div><div><font size="1">#######################################################################</font></div>
<div><font size="1">user www-server;</font></div><div><font size="1">pid logs/nginx.pid;</font></div><div><font size="1">worker_processes 8;</font></div><div><font size="1"><br></font></div><div><font size="1">error_log /usr/local/nginx/logs/error.log;</font></div>
<div><font size="1">#----------------------------------------------------------------------</font></div><div><font size="1"># Events Module</font></div><div><font size="1">#----------------------------------------------------------------------</font></div>
<div><font size="1">events {</font></div><div><font size="1"> worker_connections 1024;</font></div><div><font size="1">}</font></div><div><font size="1">#----------------------------------------------------------------------</font></div>
<div><font size="1"># HTTP Core Module</font></div><div><font size="1">#----------------------------------------------------------------------</font></div><div><font size="1">http {</font></div><div><font size="1"> include /usr/local/nginx/conf/mime.types;</font></div>
<div><font size="1"> default_type application/octet-stream;</font></div><div><font size="1"><br></font></div><div><font size="1"> log_format main '$remote_addr - $remote_user [$time_local] "$request" '</font></div>
<div><font size="1"> '$status $body_bytes_sent "$http_referer" '</font></div><div><font size="1"> '"$http_user_agent" "$http_x_forwarded_for"';</font></div>
<div><font size="1"><br></font></div><div><font size="1"> access_log /usr/local/nginx/logs/access.log main;</font></div><div><font size="1"><br></font></div><div><font size="1"> sendfile on;</font></div><div>
<font size="1"> #tcp_nopush on;</font></div><div><font size="1"><br></font></div><div><font size="1"> #keepalive_timeout 0;</font></div><div><font size="1"> keepalive_timeout 65;</font></div><div><font size="1"> upstream backend {</font></div>
<div><font size="1"> # ip_hash;</font></div><div><font size="1"> server <a href="http://192.168.65.102:8080">192.168.65.102:8080</a> srun_id=a;</font></div><div><font size="1"> #server <a href="http://192.168.65.103:8080">192.168.65.103:8080</a>;</font></div>
<div><font size="1"> jvm_route $cookie_JSESSIONID reverse;</font></div><div><font size="1"> }</font></div><div><font size="1"> server {</font></div><div><font size="1"> listen 80;</font></div>
<div><font size="1"> server_name <a href="http://report-int.example.com">report-int.example.com</a>;</font></div><div><font size="1"> root /var/www/<a href="http://example.com/">example.com/</a>;</font></div>
<div><font size="1"><br></font></div><div><font size="1"> location / {</font></div><div><font size="1"> if (-f $document_root/maintenance.html) {</font></div><div><font size="1"> return 503;</font></div>
<div><font size="1"> }</font></div><div><font size="1"> proxy_pass <a href="http://backend">http://backend</a>;</font></div><div><font size="1"> proxy_redirect off;</font></div><div>
<font size="1"> proxy_set_header Host $host;</font></div><div><font size="1"> proxy_set_header X-Real-IP $remote_addr;</font></div><div><font size="1"> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;</font></div>
<div><font size="1"> client_max_body_size 10m;</font></div><div><font size="1"> client_body_buffer_size 128k;</font></div><div><font size="1"> proxy_connect_timeout 90;</font></div>
<div><font size="1"> proxy_send_timeout 90;</font></div><div><font size="1"> proxy_read_timeout 90;</font></div><div><font size="1"> proxy_buffer_size 4k;</font></div>
<div><font size="1"> proxy_buffers 4 32k;</font></div><div><font size="1"> proxy_busy_buffers_size 64k;</font></div><div><font size="1"> proxy_temp_file_write_size 64k;</font></div>
<div><font size="1"> }</font></div><div><font size="1"> error_page 503 @maintenance;</font></div><div><font size="1"> location @maintenance {</font></div><div><font size="1"> rewrite ^(.*)$ /maintenance.html break;</font></div>
<div><font size="1"> }</font></div><div><font size="1"> error_page 404 /404.html;</font></div><div><font size="1"> location = /404.html {</font></div><div><font size="1"> root /usr/local/nginx/html;</font></div>
<div><font size="1"> }</font></div><div><font size="1"> # redirect server error pages to the static page /50x.html</font></div><div><font size="1"> #</font></div><div><font size="1"> error_page 500 502 503 504 /50x.html;</font></div>
<div><font size="1"> location = /50x.html {</font></div><div><font size="1"> root /usr/local/nginx/html;</font></div><div><font size="1"> }</font></div><div><font size="1"> }</font></div><div>
<font size="1">}</font></div></div></div>