Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
    
nginx doesn't sent an HTTP redirect on 502 errors by default, so you need to find out what is sending that. –  mgorven Jun 10 '12 at 2:56
add comment

1 Answer

You can try this one

location / (
error_page 502 @fallback;
)

location @fallback (
proxy_pass http://backend;
)

This will do not change a browser's url

ref: http://wiki.nginx.org/HttpCoreModule#error_page

share|improve this answer
    
thanks for help. but where i can put my custom message ? I have read wiki but seem it too hard 2 understand 4 me :( –  user123862 Jun 7 '12 at 10:38
    
@user123862 if your custom 502 page is in xaluan.com/502.html, just use it like proxy_pass http://xaluan.com/502.html. i can't sure it works but maybe. –  Deminoth Bono Jun 7 '12 at 12:43
    
i test with .. proxy_pass xaluan.com/502.html; but config not even pass the reload of nginx test –  user123862 Jun 8 '12 at 0:54
    
I have update detail config to basebin could you have look. thanks –  user123862 Jun 10 '12 at 2:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.