Answer the question
In order to leave comments, you need to log in
How to defeat 504 Gateway Time-out error on Django→uWSGI→nginx stack?
I actually set up a web server on Raspbery pi . The matter is completely new for me, especially in terms of setting up nginx and uWSGI (before that, I set everything up for apache and passenger_wsgi). But it still turned out to set up and the web server started working. In order not to forget how this is done (and I had to go through a fair garden of rakes), I made a memo instruction for myself in the githab of my project . There is the whole sequence of installations, settings, conf- and ini-files. You can see what is configured and how.
But I have several scripts in my project that take a long time to work. Reindexing the whole tree, in particular. With 10,000 items in the category tree, re-indexing can take about 10 minutes. Moreover, this script works fine both on the Django development server and when uploaded to the production server under apache + passenger_wsgi . But on Raspberi pi with nginx and uWSGI crashes after 60 seconds at 504 Gateway Time-out.
I tried to change the value harakiri
in the uWSGI ini settings... I played with the options keepalive_requests
, keepalive_timeout
, proxy_read_timeout
, client_header_timeout
, client_body_timeout
and send_timeout
nginx configs. He put them in bolts http
, and server
, and location
. I set the settings both in the nginx.conf of my site and in the global config /etc/nginx/nginx.confnginx. No effect. The script falls off after 60 seconds, no matter what settings I set.
Of course, I didn’t forget to restart nginx after changing the settings every time after sudo service nginx restart
changing its settings, and restart uWSGI when editing its ini. To no avail. The script still dies after 60 seconds.
What to do? What other magic could there be to defeat 504 Gateway Time-out?
Answer the question
In order to leave comments, you need to log in
Never do this.
You need to run the script and fall off with code 200.
For this kind of thing, you can do all sorts of collective farm decisions (running a script from cron with a frequency of 1 min, watching on the file system) or working with Celery
In a typical ubuntu bash there is a $USER variable and you can make a variable for the current bash session export $SITE_NAME=www.foo.bar
===
It is not necessary to change ./configure for nginx - by default it is quite ok
Do not make make install or you should put everything in /opt
Alternatively, the manual for building deb https://serversforhackers. com/compiling-third-part...
Directory /etc/nginx/sites-enabled/ is no longer relevant
Use /etc/nginx/conf.d/
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question