How to Creat custom content for nginx error 502 page, keep origin url on browser
Posted
by
user123862
on Server Fault
See other posts from Server Fault
or by user123862
Published on 2012-06-07T06:21:44Z
Indexed on
2012/06/10
4:42 UTC
Read the original article
Hit count: 575
nginx
i'm trying to get custom language and message for nginx error page but keep url on browser.. not success for eg: i go to url : xaluan.com/aaa/bbb.html on the time server down.. nginx will show error 502. with the same url but custom message as my language.
test 1.
I created a custom page at /usr/local/nginx/html/205.html
as following config but it show on web site when error is default nginx error at domain.com/50.html ( the content of webpage not same as i created)
error_page 502 /502.html;
location = /502.html {
root /usr/local/nginx/html;
}
test 2. Then i create same page at my www domain folder /home/xaluano/public_html/502.html but this keep redirect me to root domain.com/502.html the content now same as i created. but.. the url still not as i need
error_page 502 /502.html;
location = /502.html {
root /home/xaluano/public_html;
internal;
}
EDIT UPDATE for more detail 10/06/2012 please download my nginx config http://pastebin.com/7iLD6WQq and vhost config following: http://pastebin.com/ZZ91KiY6
== the case test..
if apache httpd service stop: #service httpd stop
then open browser go to:
xaluan.com/modules.php?name=News&file=article&sid=123456
I will see the 502 error with the same url on browser address
== Custome error page I need the config which help when apache fail .. will show the custom message tell user wail for 1 minute for service back then refress current page with same url ( refresh I can do easy by javascript ), Nginx dosent change url so java-script can work out.
any help will be great.. thank in advance
© Server Fault or respective owner