I am running Magento (ecommerce PHP app) behind nginx as a reverse proxy to Apache which is running the PHP app. Static content is served directly by nginx. Magento has a "maintenance mode" which uses a 503 HTTP response. With my configuration when maintenance mode is enabled nginx returns a blank page with a 500 response instead of Magento's nice maintenance mode page with the 503 response. How can I make nginx let the 503 page pass through to the client?
Here is my nginx config:
upstream examplecluster { server 1.2.3.4:80; } server { listen 1.2.3.5:80; server_name www.example.com; root /var/www/example.com/www; # security location ~ (/(app/|includes/|lib/|pkginfo/|var/|report/config.xml|downloader/(pearlib|template|Maged)/)|/\.svn/|/\.ht.+) { return 404; } location ~ \.php$ { proxy_pass http://examplecluster; proxy_redirect default; } # static content location / { try_files $uri @apache; expires 7d; } # Apache location @apache { proxy_pass http://examplecluster; proxy_redirect default; } }
Turns out there was truly an error while serving the 503 page so nginx was forwarding the response correctly afterall.
However, the relevant nginx setting is
proxy_intercept_errors off;
which is already the default..I know this is an rather old thread. - But why don't you just let nginx serve both static and dynamic content ?
I mean, nginx is already a webserver that can be used for running the magento application. And you have already configured it for handling the static content. It would be easy to let it handle the dynamic contant as well right ?