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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:29:52+00:00 2026-05-14T00:29:52+00:00

Sometimes my whole Django based site goes into 504 gateway timeout errors so none

  • 0

Sometimes my whole Django based site goes into 504 gateway timeout errors so none page can be displayed.

Is it possible to write a shell program and cronjob it run every 5 minutes to detect such errors and restart FastCGI process if needed?

I’m currently using command below to restart FastCGI in case it’s crashed but it doesn’t work for above situation because when 504 gateway errors occur, the processes are still running.

ps ax | grep -v grep | grep port=8001 > /dev/null || restart_fcgi.sh
  • 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-14T00:29:53+00:00Added an answer on May 14, 2026 at 12:29 am

    Perhaps you should find out why the site starts serving 504 errors first – check the logs (or add logging if you don’t have enough information), and fix whatever the problem is. Alternatively, you may find nginx + apache + mod_wsgi a more stable approach – nginx is a fantastic front-end webserver for serving static content, but Apache is excellent for hosting dynamic processes. Try to combine them both. I used to use nginx + fastcgi, but I found the former to be a much more stable approach.

    If you are still unable to determine what’s causing your problem, you can set up a monitor script that runs locally and checks the response code – if it finds a 5XX it can force restart your fastcgi process. You can use Python + httplib for the script, and os.system running your shell script (plus a suitable kill -9 statement) above.

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

Sidebar

Related Questions

I know django purposely does not allow a whole lot of logic in the
How do you copy whole project/app to another name? Sometimes I'd like to make
In a Django template, is there a way to convert a float into an
Sometimes I run into situation where I find that I need to make an
I have a variable that sometimes is a whole number and sometimes has a
Sometimes, right after I submit a computation-intensive run to R in ESS, my whole
Sometimes (randomly) my asp.net mvc application outputs page where single character is being replaced
Sometimes while writing Java in Eclipse, I write code that generates warnings. A common
Sometimes when I open my app (either while resuming it after it was dormant
Sometimes it is useful to enumerate a list while it is changing. e.g. foreach

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.