Having nginx return a 503 if a file exists -


i'm looking nginx server return 503, if maintenance page exists.

server {     listen 443 ssl;     ssl_certificate /etc/nginx/ssl/xxx.crt;     ssl_certificate_key /etc/nginx/ssl/xxx.key;      server_name  _;      client_max_body_size 100m;     location / {         proxy_set_header x-forwarded-proto https;         proxy_pass http://0.0.0.0:8080;         proxy_set_header host $host;         proxy_set_header x-real-ip $remote_addr;         proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;          # return 503 error if maintenance page exists.          if (-f /var/www/xxx/shared/public/system/maintenance.html) {             return 503;         }     }     error_page 404 /404.html;    location = /404.html {        root   /usr/share/nginx/html;     }      # redirect server error pages static page /50x.html      error_page 500 502 504 /50x.html;     location = /50x.html {         root   /usr/share/nginx/html;     }     # return 503 error if maintenance page exists.     error_page 503 @503;      location @503 {     # serve static assets if found.     if (-f $request_filename) {         break;     }      # set root shared directory.     root /var/www/xxx/shared/public;       rewrite ^(.*)$ /system/maintenance.html break;     } } 

this seems correct, it's not working. have verified file in correct place not working expected. i'm still getting same old nginx error page.

i have reloaded it, still same response.

edit : placed whole conf file.


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -