Questions tagged [gunicorn]

A Python WSGI HTTP Server for UNIX, light and speedy. It's a pre-fork worker model ported from Ruby's Unicorn project. http://gunicorn.org

122 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
8 votes
0 answers
1k views

How many celery and gunicorn workers on the same server?

I have one server that runs a Django application served by gunicorn and a Celery task queue. Gunicorn docs suggest (2 x $num_cores) + 1 as the default number of workers. Celery docs show that the ...
YPCrumble's user avatar
  • 175
6 votes
2 answers
30k views

Unable to restart a systemctl service remotely as a non root user

I have a systemd.socket named gunicorn.socket which I would like to restart after updating some code on a remote server. I've followed the steps detailed in Allowing a non-root user to restart a ...
marcanuy's user avatar
  • 268
4 votes
1 answer
11k views

Supervisor doesn't start: couldn't chdir to ... EACCES

I'm setting up an ec2 server to run a django project with ngnix & gunicorn. The server is running Amazon Linux. When I run the start gunicorn command from the command line, it starts up the ...
hgolov's user avatar
  • 141
4 votes
0 answers
904 views

Prevent Gunicorn from loading slowly after an inactive period?

My Django project is running on gunicorn. Sometimes loading a page (and oracle procedures calls related) takes a lot of time. This occurs 90/100 when the server remains inactive for some minutes. How ...
Sam's user avatar
  • 151
4 votes
1 answer
2k views

Trying to run gunicorn from supervisor gives error - error: class uri 'simple' invalid or not found

I am already running successfully 2 django projects (in same virtualenv with python 2.7) with Django + gunicorn + virtualenv + Supervisord environment. But now i am trying to run another project in ...
Muhammad Tahir's user avatar
3 votes
0 answers
4k views

Load testing throws Server 502 error: Bad Gateway after 700 users. Gunicorn, Gevent, Nginx, Django

I'm trying to reach 2000 concurrent users with my benchmarking tool. I'm using locust to simulate them. My server has 24vCPUs, 128GB RAM, 25SSD. I want to be able to serve 2000 concurrent users ...
Tony Kyriakidis's user avatar
3 votes
1 answer
2k views

Nginx redirecting every url to localhost

I have a Django website running with Nginx and Gunicorn. Everytime I call a url on the server, example website/url, it redirects to localhost/url. I have given the nginx settings in both nginx.conf ...
Shounak's user avatar
  • 31
3 votes
0 answers
3k views

Can't connect to (or write to) a socket file, despite being owner?

I am working on Debian Jessie with Django 1.8, trying to set up Gunicorn to run my Django site. I have made a user called opuser, and made this user the owner of the gunicorn.sock file and of the ...
Richard's user avatar
  • 263
3 votes
1 answer
5k views

Debugging Gunicorn + Nginx + Django

I'm trying to deploy a readthedocs instance on my own server. The recommended way to deploy is using Gunicorn + nginx with postgres. Because there's basically no documentation on how to do this (...
bertzzie's user avatar
  • 131
2 votes
1 answer
1k views

Why is Nginx truncating the JSON streaming response?

Our stack is Client(Browser) <-> Nginx Reverse Proxy <-> Webserver(Flask+Gunicorn) <-> Golang gRPC server The problem is when the client makes a call to the /realtimedata endpoint, ...
Paul Côté's user avatar
2 votes
0 answers
284 views

How to load balance in nginx based on user category

There will be a web application served by gunicorn with pod instantiated in every node in Kubernetes cluster. External load balancer (limited to the round-robin or least connections methods) drives ...
ipaleka's user avatar
  • 121
2 votes
1 answer
3k views

Gunicorn does not generate a sock file

First, I'm new to this subject. So I'm trying to serve a hello world flask app with nginx and gunicorn on a Centos7 server. But I'm getting 502 error on website. When I checked nginx's error.log file ...
Saba's user avatar
  • 21
2 votes
1 answer
5k views

How to resolve nginx internal server error

I'm configuring Nginx as a public-facing proxy server to my internal Gunicorn server to host a "Reddit clone" Flask project I'm developing. At one point, Nginx was working properly (when I'd used ...
Neil Patel's user avatar
2 votes
1 answer
5k views

nginx, gunicorn, Django 499 error 60s

I get a 499 error after 60s whatever the config I try. I use Docker on a 8 core/32GB server and there is another nginx/lets-encrypt reverse proxy in front for the others containers. I am more on the ...
Patrick Aymar's user avatar
2 votes
0 answers
453 views

Performance Decrease When Using Nginx as Reverse Proxy for Sanic + Gunicorn

I'm just starting to learn Sanic framework because of its fast benchmark. I made a simple hello world API, then connected it with Gunicorn. The performance was quite good, but when I combined it with ...
Kadek Dwi Budi Utama's user avatar
2 votes
1 answer
4k views

Apache 502 Error With Upstream Proxy Raising 413

We have a Python Flask API running in gunicorn being fronted by apache. ProxyPreserveHost On <Location /api/v2> ProxyPass http://127.0.0.1:8090/ disablereuse=on SetEnv proxy-sendcl </...
mmcclannahan's user avatar
2 votes
0 answers
3k views

Nginx fails with "104: Connection reset by peer" when Gunicorn returns a 500

I am running Django with Gunicorn (19.6.0) behind Nginx (1.6.2). Everything works fine with one small problem. If I send a POST request with a JSON payload larger then about 10KB and Django replies ...
tobltobs's user avatar
  • 219
2 votes
1 answer
3k views

Nginx+gunicorn 404

supervisorctl says that gunicorn procces have a RUNNING state and I thought that it is success. But something is wrong yet. Resource available only by IP Nginx config: upstream hello_app_server { ...
Vassily's user avatar
  • 105
2 votes
0 answers
761 views

What is the right way to host different Django apps as nginx locations

I have a static website (www.example.com) and a Django app (example.com/app1) running on a single server machine (machine 1). Both the website and the app are served using nginx. I am using gunicorn ...
fr3d-5's user avatar
  • 141
2 votes
1 answer
2k views

Setup ssl on nginx for a django project

I want to setup ssl for Nginx, my project is a Django and I also use gunicorn as wsgi Http server. I add following lines in my settings.py code : CSRF_COOKIE_SECURE = True SESSION_COOKIE_SECURE = ...
Mairon's user avatar
  • 159
2 votes
0 answers
869 views

File upload through Nginx with proxy_pass to Gunicorn is slow (Ubuntu 14)

I previously was running Ubuntu 12 where I had Nginx receive large file uploads, and then proxy_pass it to gunicorn / django (port 8000). This worked fine once I figured out I needed to set ...
user2701815's user avatar
2 votes
1 answer
1k views

Nginx not getting the real visitor IP in server block

I am using a loadbalancer in my current setup, requests come from ip 10.71.128.13. I am using Nginx as a front to a Gunicorn backend. I want to get the real IP address of the visitor and log it (not ...
Daniel Pilch's user avatar
2 votes
0 answers
710 views

Nginx > Varnish > Gunicorn Error Too many Redirections

I have the following config: Nginx > Varnish > Gunicorn > Django I want to cache 2 versions of same site (mobile & web) with Varnish. Gunicorn : WEB: gunicorn_django --bind 127.0.0.1:8181 ...
kollo's user avatar
  • 21
2 votes
0 answers
1k views

Stress testing Django app - how to improve throughput?

I'm having my first attempt at stress testing a simple django web app running from gunicorn and nginx which I’ve put on a small 256MB Rackspace Cloud server. Using httperf, I increase the number of ...
Pete W's user avatar
  • 143
1 vote
0 answers
206 views

The Site cannot be reached - Docker - Gunicorn

I have have a Docker container running on Linux Machine. When I tried to access it on Browser it says This site can’t be reached 10.xxx.xx.xx took too long to respond. Try: Checking the connection ...
Usman Rafiq's user avatar
1 vote
0 answers
123 views

nginx Failing to Serve Static Files to Flask

I've tried numerous solutions of other posts, but nothing seems to work for me, I always get a 404 error, when trying to let nginx serve static files of my flask application. On my local host server, ...
AnthonyShea's user avatar
1 vote
0 answers
521 views

100 concurrent requests to a Django-App with Gunicorn lead to "54: Connection reset by peer" and 502's

I'm hosting a Django-App which serves as an API-Endpoint. Unfortunately the App which uses the API does a lot of concurrent requests on page-load (in the realm of 80-90 requests). Nginx is running as ...
Subito's user avatar
  • 398
1 vote
0 answers
460 views

How to disable upstream buffering Nginx + Docker + Gunicorn?

I'm trying to use Nginx as proxy server between client and Gunicorn. Nginx, Gunicorn (Django) are Docker's containers. Problem is I can't disable buffering of upstream when I send large file from ...
Vokson's user avatar
  • 11
1 vote
0 answers
191 views

Response with and in memory file with Django and nginx

I have a piece of code that works fine on my local setup (Django embeded dev server running on Windows) but not on server (ubuntu + gunicorn + nginx) I build an Excel file et send it from memory like ...
Yvain's user avatar
  • 121
1 vote
2 answers
2k views

Gunicorn/Flask reject identical SSL certificate that works fine with Apache

What would cause a Gunicorn server running a Flask app to report a "sslv3 alert certificate unknown" error in the browser, when an Apache server running a WSGI app, using the exact same ...
Cerin's user avatar
  • 3,650
1 vote
0 answers
2k views

Nginx stopped and failed to restart - open() “/run/nginx.pid” failed

I am running my django apis, deployed on Ubuntu 18, on Nginx and running via Supervisor. I am using Certbot for SSL certs and this is the only web service running on this webserver. No other websites ...
Deepak's user avatar
  • 111
1 vote
0 answers
3k views

Why is gunicorn not creating a .sock or .pid file?

First things first, I would like to clarify that I am completely knew to debugging servers and deploying in general. I'm a student developer for my university and so far all of my work has been ...
JohnnyLeek's user avatar
1 vote
0 answers
874 views

Server crash (Error 500) repeatedly (running nginx + gunicorn on EC2 instance)

Okay, so I'm really confused about what's happening here. I've had my server up and running for about a month and everything was fine. The server was getting very little traffic (about 50-100 requests ...
user1101329's user avatar
1 vote
1 answer
788 views

Apache mod_expires not setting correct expires datetime

I'm having a problem with mod_expires. I simply set have a default expires of 1 days and then I set the expires by type (for images and audio). So for example i set ExpiresByType image/jpeg "access ...
Isky's user avatar
  • 121
1 vote
0 answers
698 views

docker-compose, nginx, gunicorn and SSL

I'm trying to set up a django project using SSL. I got it working without SSL but I'm clearly doing something wrong since https:// doesn't work and http:// just redirects to the main nginx site. Here'...
pnus's user avatar
  • 33
1 vote
0 answers
1k views

Trying to setup a Django app using gunicorn and systemd

Trying to setup a Django app using Gunicorn and Systemd while following this tutorial by DigitalOcean. When I run curl --unix-socket /run/gunicorn.sock localhost, it returns with curl: (56) Recv ...
mystlegend's user avatar
1 vote
0 answers
682 views

Gunicorn behind Nginx - high number of TIME_WAIT during load test

nginx version: nginx/1.9.3 gunicorn (version 19.7.1) I have a small flask API running through gunicorn behind nginx. When I load test directly through gunicorn everything is working fine, however as ...
nick_v1's user avatar
  • 365
1 vote
0 answers
6k views

Nginx (104: Connection reset by peer) while SSL handshaking to upstream

I get this error after setting up nginx with this digital ocean tutorial https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04 My system: Nginx, ...
Lawrence Muriuki's user avatar
1 vote
0 answers
1k views

Systemd start-up service for gunicorn stays inactive

I have configured the gunicorn.py configuration file to start the python server which is binded to the nginx. Everything works fine except the start up service. I am using the systemd Service ...
Nazar Filipchuk's user avatar
1 vote
1 answer
5k views

Reducing gunicorn CPU usage on tiny requests

I'm writing an event aggregation server in Python, using Nginx + Gunicorn. The system scales to about 300 rps before the CPU maxes out on a 1 cpu/2 core box (AWS c4.large). Adding an additional ...
JasonB's user avatar
  • 111
1 vote
0 answers
279 views

Gunicorn root view no longer works with SSL nginx proxy

I have a Django project that shows a login view on the root directory. Here's the url pattern: url(r'^$', views.login_view, name="root_login") This works on an unencrypted connection: when I visit ...
Escher's user avatar
  • 151
1 vote
0 answers
2k views

Supervisor doesn't run gunicorn with django

I want to run supervisor in my Django server with gunicorn and Nginx, but when I run "supervisord" the supervisor log says: 2015-11-06 23:23:36,746 INFO daemonizing the supervisord process 2015-11-06 ...
Ligorio Edwin Salgado Flores's user avatar
1 vote
1 answer
2k views

nginx - 502 Bad Gateway ubuntu 14.04 aws ec2 django project + gunicorn

I'm trying to get my django project up and running on an aws ec2 instance. I'm using gunicorn with nginx, and I'm not really sure how I can tackle this problem. I've spent a couple hours on it already,...
pyramidface's user avatar
1 vote
0 answers
2k views

no module named 'project' in gunicorn using Django 1.8 & python 3.4

I've deployed with ansible a project using Django 1.8 and python3.4 in a virtualenv folder. For my projects including settings and wsgi in a config folder it works, the deployment is fine and it works....
Emilio Conte's user avatar
1 vote
0 answers
1k views

Nginx returning 500 Error instead of 400 Error

On validating user input into my api, I want to return 400 http status codes for bad requests. It works fine from flask and when running my api through gunicorn, but they always come out of nginx ...
bcollins's user avatar
  • 113
1 vote
0 answers
1k views

Error message before downtime: posix_memalign(16, 4096) failed (12: Cannot allocate memory)

I have a server running Django on top of Gunicorn and Nginx, and I experienced a small amount of downtime last night. After restarting Nginx and Gunicorn the server went back to normal, but I can't ...
benwad's user avatar
  • 265
1 vote
1 answer
2k views

Connection refused while connecting to upstream from nginx to gunicorn_django

I'm trying to get my server back online after an upgrade, and I can no longer seem to get Nginx to direct calls to Gunicorn - every request I send to the site gets back a 502 Bad Gateway. I have ...
benwad's user avatar
  • 265
1 vote
0 answers
985 views

Varnish server in front of nginx server with multiple virtualhosts

I have tried to search for a solution for this, but can't find any documentation/tips on my specific setup. My setup: Backendserver: ngnix: 2 different websites (2 top domains) in virtualenv, ...
Tomas Jacobsen's user avatar
1 vote
1 answer
2k views

Gunicorn error: "Error opening file for reading: Permission denied"

I'm getting an error when running my Django app with gunicorn: when I make a post request over 7800 bytes I see the following error from gunicorn: "Error opening file for reading: Permission denied". ...
Michael Waterfall's user avatar
1 vote
1 answer
5k views

Apache as a reverse proxy not working for gunicorn

My Goal is to let client connect through https connection but apache serve it to my application which is running on same server over http. Here is my minimalistic apache configuration file (for ...
Aamir Rind's user avatar