Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

220
Views
Nginx reverse proxy is not responding to requests after load test

I have deployed Gunicorn (with flask) behind Nginx (as a proxy server). I use 2 docker containers (Gunicorn , Nginx).

I started a load test of "5000 concurrent users", sending requests to the Nginx server on port 80 (using Locust). after few seconds i stopped the load test. After I stopped the load test, Nginx stopped to respond to requests at all (but I can still send requests to Gunicorn directly on port 8000).

Im not expecting Nginx to respond to so many concurrent requests while running on my system with 1 Gunicorn server, but why it's not responding to requests anymore? I need to restart the Nginx container to make it available again. The reason I added Nginx is because I observed the same behavior while performing load tests on Gunicorn directly.

I would expected Nginx to either block or queue requests , but not to freeze/block requests forever.

What am i doing wrong? What is the correct configuration to allow many concurrent requests (using 1 Nginx container & 1 Gunicorn container)?

My system: MacBook Pro 2.9 GHz 6-Core Intel Core i9 32 GB 2400 MHz DDR4

Gunicorn config:

bind = '0.0.0.0:8000',
workers = 8 (sync),
loglevel = 'info',
preload_app=true

Nginx config:

worker_processes 8;

user nobody nogroup;
error_log /dev/stdout info;
pid /var/run/nginx.pid;
    
events {
  worker_connections 20000; # increase if you have lots of clients
  accept_mutex on; # set to 'on' if nginx worker_processes > 1
    }
    
http {
  include mime.types;
  default_type application/octet-stream;
  access_log /var/log/nginx/access.log combined;
  sendfile on;


  server {
    # if no Host match, close the connection to prevent host spoofing
    listen 80 default_server;
    return 444;
  }

  server {
    listen 80;
    client_max_body_size 4G;

    # set the correct host(s) for your site
    server_name localhost;

    keepalive_timeout 5;

    # path for static files
    root /path/to/app/current/public;

    location / {
      # checks for static file, if not found proxy to app
      try_files $uri @proxy_to_app;
    }

    location @proxy_to_app {
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_set_header Host $http_host;
      # we don't want nginx trying to do something clever with
      # redirects, we set the Host: header above already.
      proxy_redirect off;
      proxy_pass http://flask-container:8000;
    }

    error_page 500 502 503 504 /500.html;
    location = /500.html {
    root /path/to/app/current/public;
    }
      }
    }

Thanks is advance.

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!