Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggested nginx configuration for web:disable isn't working #378

Closed
jeremywadsack opened this issue Feb 5, 2013 · 1 comment
Closed
Labels

Comments

@jeremywadsack
Copy link

The configuration suggestion in capistrano's deploy:web:disable task (from #142) doesn't work for me. It says to add the following:

    if (-f $document_root/system/maintenance.html) {
      return 503;
    }
    error_page 503 @maintenance;
    location @maintenance {
      rewrite  ^(.*)$  /system/maintenance.html last;
      break;
    }

However, when I use this, it loads the nginx default 503 error page, not the custom page uploaded by capistrano. Following instructions from this post I was able to get it to work using this:

    if (-f $document_root/system/maintenance.html) {
      return 503;
    }
    error_page 503 @maintenance;
    location @maintenance {
      rewrite  ^(.*)$  /system/maintenance.html break;
    }

Reviewing the nginx documentation I believe that the problem is that the last directive starts the process over again and ends up with the 503 error. Whereas break just sends the page.

We are running nginx 1.2.4:

nginx version: nginx/1.2.4
built by gcc 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC) 
TLS SNI support enabled
configure arguments: --prefix=/opt/nginx --with-http_ssl_module --with-http_gzip_static_module --with-cc-opt=-Wno-error --add-module=/usr/local/rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.14/ext/nginx --with-ipv6 --with-http_stub_status_module --add-module=masterzen-nginx-upload-progress-module-a788dea/

I am happy to provide a pull request for this, but wanted to get others' feedback in case it's more complicated.

@leehambley
Copy link
Member

Fixed in 16bf6ae

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants