Last active
January 16, 2018 04:17
-
-
Save StevenJL/60f3174ad824c4c9e2582f7f0d6d47f6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If there the upstream server errors, we want to with an error page. | |
# Note the `location` directive here is performing a regex match. | |
location ~* (script1|script2|script3)\.php$ { | |
proxy_pass http://192.168.0.1; | |
# The `error_page` directive will return the document file | |
# 50x.html depending on the upstream error. | |
error_page 500 502 503 504 /50x.html; | |
} | |
# Sometimes if the upstream server returns an error we want to | |
# go to a retry location. | |
location ~* (script4|script5|script6)\.php$ { | |
proxy_pass http://upstream; | |
error_page 500 502 503 504 403 404 @retry; | |
} | |
# The retry location tries a different upstream and if that still | |
# errors, it returns an error page. | |
location @retry { | |
proxy_pass http://upstream_backup; | |
error_page 500 502 503 504 = 200 /50x.html; | |
} | |
# vi: ft=nginx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment