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?
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/