Home  >  Q&A  >  body text

nginx tcp link problem

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:

为情所困为情所困2712 days ago544

reply all(2)I'll reply

  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-16 17:28:09

    Come and read this article, it should be the same situation

    reply
    0
  • PHPz

    PHPz2017-05-16 17:28:09

    The one upstairs is the correct answer

    reply
    0
  • Cancelreply