Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8065559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:42:17+00:00 2026-06-05T11:42:17+00:00

Sometimes I get an issue with error 502 when httpd service is down. But

  • 0

Sometimes I get an issue with error 502 when httpd service is down.
But only in 1 minute the website come back.

I need to custom the 502 message to ask user to wait for 1 minute then refresh page, or embed JavaScript or meta refresh tag to auto refresh page after 1 minute.
Page’s URL must be the same to make refresh effect

Notice that I know about custom error page redirect eg location = /502.html, but that type of custom error page will redirect user to other page, if they will refresh page they will got error page again.

Any idea will be very helpful.


EDIT UPDATE for more detail 10/06/2012.

My nginx config:

user  nobody;
# no need for more workers in the proxy mode
worker_processes  24;
error_log  /var/log/nginx/error.log crit;
#worker_rlimit_nofile 20480;
events {
 worker_connections 109024; # increase for busier servers
 use epoll; # you should use epoll here for Linux kernels 2.6.x
}

http {
 server_name_in_redirect off;
 server_names_hash_max_size 2048;
 server_names_hash_bucket_size 256;
 include    mime.types;
 default_type  application/octet-stream;
 server_tokens off;
 sendfile on;
 tcp_nopush on;
 tcp_nodelay on;
 keepalive_timeout  20;

 ignore_invalid_headers on;
 client_header_timeout  50m;
 client_body_timeout 50m;
 send_timeout     20m;
 reset_timedout_connection on;
 connection_pool_size  2048;
 client_header_buffer_size 256k;
 large_client_header_buffers 4 256k;
 client_max_body_size 20M; 
 client_body_buffer_size 300k;
 request_pool_size  32k;
 output_buffers  14 32k;
 postpone_output  1460;
 proxy_temp_path  /tmp/nginx_proxy/;
 proxy_cache_path /dev/shm/nginx levels=1:2 keys_zone=wwwcache:45m inactive=5m max_size=1000m;
 client_body_in_file_only off;
 access_log off;
 open_log_file_cache off;
 #log_format bytes_log "$msec $bytes_sent .";
 include "/etc/nginx/vhosts/*";
}

and vhost config:

server {
 #         error_log /var/log/nginx/vhost-error_log warn;
          listen 123.30.137.66:80;
          server_name xaluan.net mtvvui.com www.daiduong.com.au www.xaluan.net xaluan.com www.xaluan.com www.daiduongrestaurant.net veryzoo.com www.mtvvui.com www.xaluan.org www.veryzoo.com daiduongrestaurant.net xaluan.org daiduong.com.au;
#          access_log /usr/local/apache/domlogs/xaluan.net combined;
          root /home/xaluano/public_html;
          location / {
      if ($http_cache_control ~ "max-age=0") {
                set $bypass 1;
          }

      location 
~.*\.(3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|htm|txt|js|css|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso)$ 
{
      #root /home/xaluano/public_html;  
    #proxy_cache wwwcache;
      #proxy_cache_valid  200 15m;
      #proxy_cache_bypass $bypass;
          expires 1d;
          #try_files $uri @backend;
      proxy_pass http://123.30.137.66:8081;
          }
          error_page 405 = @backend;
          add_header X-Cache "HIT from Backend";
      #proxy_set_header Server "Caching-Proxy";
          #add_header X-Cache-Vinahost "HIT from Backend";
      proxy_pass http://123.30.137.66:8081;
          include proxy.inc;

          }


          location @backend {
          internal;
          proxy_pass http://123.30.137.66:8081;
          include proxy.inc;
          }
          location ~ .*\.(php|jsp|cgi|pl|py)?$ {
          #proxy_cache wwwcache;
      #proxy_cache_valid  200 15m;

      proxy_pass http://123.30.137.66:8081;
          include proxy.inc;
          }
          location ~ /\.ht {
          deny all;
          }

     }

== the case test..

If Apache httpd service stops: #service httpd stop

Then open in browser this link:
http://www.xaluan.com/modules.php?name=News&file=article&sid=123456
You will see the 502 error with the same URL on browser address.

== Custom error page
I need the config which will help when Apache fail, will show the custom message telling user to wait for 1 minute for service back, then refresh current page with same URL (refresh I can do easy by JavaScript), Nginx does not change URL so JavaScript can work out.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T11:42:20+00:00Added an answer on June 5, 2026 at 11:42 am

    I found an answer that works for me.
    In the vhost config file, I put right at the end of the server block, before closing brace:

     error_page 502 /502.html;
     location = /502.html {
    
          root  /home/xaluano/public_html;
    
      }
    

    Of course I also need to create a file 502.html at my domain root, with the meta-tag refresh, and java-script auto refresh.

    The content of html page is:

    <head>
    <meta http-equiv="refresh" content="40" /> 
    </head>
    <body>
    <script language="JavaScript" type="text/javascript">
    /*<![CDATA[*/
    var TimerVal = 40;
    var TimerSPan = document.getElementById("CDTimer");
    function CountDown(){
       setTimeout( "CountDown()", 1000 );
       TimerSPan.innerHTML=TimerVal;
       TimerVal=TimerVal-1;
       if (TimerVal<0) { TimerVal=0;
       location.reload(true); 
    //   window.location.href = "http://www.xaluan.com";
       } //improvement by vivalibre, tq 
    }
    CountDown();
    /*]]>*/ </script> 
    </body>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have some applications that sometimes get into a bad state, but only in
We use ERPConnect in our ASP.NET application but sometimes we get some error messages
The issue is that sometimes I get this error in Google Chrome when I
When i issue a SQL query, sometimes I get the following error message: Cannot
In Ruby on Rails, I sometimes get an error on the page as: compile
When working with ActiveMQ in Eclipse, you might sometimes get a schema parsing error
sometimes i get an error like table is marked as corrupt and shld be
Sometimes in execution I get this error message in VS2010 when trying to free
Sometimes I get this error message from time-based trigger of many scripts ... There
I get the following error when overwriting my asp.net .dll sometimes on my web

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.