1. Currently, my nginx configuration is started on port 80, and then I have a background service started on port 8080
I use nginx as a reverse proxy. The background service will start automatically after it hangs up. The problem I am currently encountering is that after the background service hangs up, an error will be reported when it starts up again:
Bind port 8080 error: Address already in use
Then netstat to see:
sudo netstat -anpto |grep 127.0.0.1
tcp 0 0 127.0.0.1:8080 127.0.0.1:8080 ESTABLISHED 3841/nginx off (0.00/0/0)
What I am confused about is why the situation where I am connected to myself appears?
nginx configuration:
upstream test.com{
server 127.0.0.1:8080;
}
server
{
listen 80;
server_name test.com;
index index.html index.htm index.php;
location / {
proxy_pass http://test.com;
add_header cache-control "no-cache, max-age=0";
add_header Pragma "no-cache";
}
Relevant information:
Come and read this article, it should be the same situation
The one upstairs is the correct answer