When configuring nginx for forwarding on Windows, it is found that the forwarding delay is very high, more than 1 minute.
1. Use http://127.0.0.1:80
When requesting the service directly, the delay is normal, about 50ms
2. Through https://domain name:443
After forwarding through nginx, it takes about 1 minute for some requests to access.
problem solved:
location /api/ {
#The startup port of this backend program
root C:\5G\5GApi; #Site directory.
proxy_pass http://localhost:8888/;
}Change proxy_pass http://localhost:8888/; to proxy_pass http://127.0.0.1:8888/;
In this way, the forwarding delay returns to normal.
Specific reasons:
nginx visits localhost first, and then visits 127.0.0.1 after the visit times out
Nginx configuration suggestions:
Try to avoid using localhost
Use real IP, 127.0.0.1 or internal network address or public network IP.