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 7669231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:32:54+00:00 2026-05-31T15:32:54+00:00

I have a server (nginx) which is routing some urls to static directories, and

  • 0

I have a server (nginx) which is routing some urls to static directories, and others to a web.py wsgi app. The server’s config also defines a 404 page, which is displayed when somebody tries to visit a nonexistant file within a static directory.

However, sometimes a user will visit a url which nginx passes to python, and only then do I realize it should 404. At this point web.py has no problem returning a custom error page along with the correct status code; the problem is that I want it to return the same 404 page as the server does for pages that aren’t sent to python. Currently python is manually reading and printing the 404.html file, but that seems very inefficient.

So, is there any way for python to tell the server to display its own 404 page?

Here is my current nginx.conf, with commented lines removed.

worker_processes  1;    

events {
    worker_connections  1024;
}

http {
    include            mime.types;
    default_type       application/octet-stream;
    sendfile           on;
    keepalive_timeout  65;

    server {
        listen       80;
        server_name  light.info;
        root         /www/example.com/html;
        index        index.html;

        location /s/     {}
        location /error/ {}
        location /       {
            fastcgi_pass   127.0.0.1:9001;
            fastcgi_param  REQUEST_URI     $request_uri;
            fastcgi_param  QUERY_STRING    $query_string;
            fastcgi_param  REQUEST_METHOD  $request_method;
            fastcgi_param  REMOTE_ADDR     $remote_addr;
        }

        error_page  404              /error/404.html;
        error_page  403              /error/403.html;
        error_page  500 502 503 504  /error/50x.html;
    }
}
  • 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-31T15:32:56+00:00Added an answer on May 31, 2026 at 3:32 pm

    You aren’t going to have python tell nginx what to do per se, you’re going to have nginx intercept the 404’s.

    uwsgi_intercept_errors on; is what you are looking for I think assuming you’re using uwsgi. It would be helpful if you could post your current configuration…

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

Sidebar

Related Questions

I have URLs of the form http://domain/image/⟨uuid⟩/42x42/some_name.png . The Web server (nginx) is configured
I have a problem. My app server is nginx, on which my blog was
I've set up Nginx as my main web server and have two Mochiweb based
I have Nginx as my front-end web server listening on port 80. And certain
On my server, I have two users, www-data (which is used by nginx) and
I have two websites running on my own root server (ubuntu/nginx/php-fpm). Now I want
I have a client-server Silverlight application, which is use Socets. I have server appliaction
My server have default php version of 4, so when I run some script
I have a Client/Server application, where the Client and Server have some common tables
I have a server application that consists of multiple OSGi bundles, some mine, some

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.