Hi, I’ve been following this tutorial
I’m stuck on Configuring Nginx to Proxy Requests.
Nginx error logs: 2021/04/23 18:08:01 [error] 115757#115757: *4 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 80.5.115.86, server: sub.mysite.comm, request: “GET /favicon.ico HTTP/1.1”, upstream: “http://unix:/root/text_generator/textgen.sock/favicon.ico”, host: “www.sub.mysite.com”, referrer: “http://www.sub.mysite.com/”
In the browser my IP address page shows a “Welcome to nginx!” message and my website returns 504 Gateway Time-out nginx/1.18.0 (Ubuntu).
Thanks in advance I’m very stuck!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Heya,
It seems that your issue might be related to the upstream Gunicorn server timing out. To get past this problem, try the following steps:
- gunicorn --bind unix:/root/text_generator/textgen.sock yourapp:wsgi --timeout 120
Ensure there’re no typos or syntax errors in your Nginx configuration file. Pay close attention to the location block and the path that the proxy_pass directive is pointing to.
Restart the services - After making any necessary changes, restart both Gunicorn and Nginx using the commands:
- sudo systemctl restart gunicorn
- sudo systemctl restart nginx
For more information about configuring Gunicorn and Nginx, refer to this DigitalOcean tutorial: How To Serve Flask Applications with Gunicorn and Nginx on Ubuntu 20.04.
Hope that this helps!
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.