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

  • SEARCH
  • Home
  • 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 4060036
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:17:13+00:00 2026-05-20T15:17:13+00:00

I am using nginx as a frontend to an apache server. The config file

  • 0

I am using nginx as a frontend to an apache server. The config file looks like:

upstream apache {
    server localhost:8000;
}

server {
    listen 80;
    error_page 503 /www/static/503.html;

    # need some magic here #

    location /static/ {
        root /www/static/;
    }

    location / {
        proxy_path http://apache/;
    }
}

For now, when apache is down, I receive a plain 502 page generated by nginx. How to make it serve my custom error page and return status code 503 which is more relevant in this situation?

  • 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-05-20T15:17:13+00:00Added an answer on May 20, 2026 at 3:17 pm

    Something like this

    upstream apache {
        server localhost:8000;
    }
    
    server {
        listen 80;
        error_page 502 503 /www/static/503.html;
    
        location /static/ {
            root /www/static/;
        }
    
        location / {
            proxy_path http://apache/;
        }
    }
    

    You can append standard error codes together to display a single page for several types of errors.
    For example:

    error_page 502 503 /www/static/503.html;
    

    For more reference you can refer the error_page manual


    On the error_page manual it says

    Furthermore, it is possible to change
    the code of answer to another, for
    example:

    error_page 404 =200 /.empty.gif;
    

    Another option
    To make it return a different error code you can make use of a return keyword
    For example:

    # check for a condition
      if (condition) {
         return 503;
      }
    

    Also See
    nginx: Create HTTP 503 Maintenance Custom Page

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently using nginx as a transparent proxy for apache. I would like to
I'm using NGINX to segment mobile traffic between a mobile WAP/HTML site. Looks like
We're using Nginx to load balance between two upstream app servers and we'd like
i started using nginx upload module (which creates upload files like /tmp/000121545) but i
I'm using apache+mod_wsgi for django. And all css/js/images are served through nginx . For
I'm attempting to implement a Catalyst application using nginx as a frontend web proxy
I'm using Nginx as webserver, with a reverse proxy to a gunicorn django server.
I'm using nginx as a reverse proxy to apache/mod_wsgi and Django. Currently everything is
We're using Nginx on the server reserved for development (testing) and we want to
I haven't used Apache with Django very much, normally using nginx, gunicorn and a

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.