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

275
Views
why nginx reserve proxy upstream is a static website, there are many TIME_WAIT? how to slove

the nginx config:(the config is for aspnet core, but now test for a static website on iis)

server {
        listen       80;
        server_name  localhost;

        location / {
            proxy_pass         http://localhost:81;
            proxy_http_version 1.1;
            proxy_set_header   Upgrade $http_upgrade;
            proxy_set_header   Connection keep-alive;
            proxy_set_header   Host $host;
            proxy_cache_bypass $http_upgrade;
            proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header   X-Forwarded-Proto $scheme;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }

after every times access http://localhost from chrome, TIME_WAIT + 1.

this both happened on windows 10 + nginx and ubuntu 16.04 + nginx

why this happened? how to slove this? for help

i tried change the kernel config, but that isn't what i want, i need to know why this happened? is my nginx config lead this? or else?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I presume you are concerned about port exhaustion. You should change your proxy_pass to use an upstream block, and then enable a keep-alive pool on the upstream. eg:

upstream backend {
    server 127.0.0.1:81;
    keepalive 20;
}

location / {
    proxy_pass         http://backend;
    proxy_http_version 1.1;
    proxy_set_header   Upgrade $http_upgrade;
    ...
}

Also have a look at the NGINX blog: https://www.nginx.com/blog/overcoming-ephemeral-port-exhaustion-nginx-plus/

over 4 years ago · Santiago Trujillo Report
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!