首页 > nginx 的 tcp 的链接问题

nginx 的 tcp 的链接问题

1、目前我的 nginx 的配置是启动的 80 端口,然后我有一个后台服务是启动的 8080 端口
我使用 nginx 做的反向代理,后台服务挂掉后会自启动,目前遇到的问题是,后台服务挂掉后,再自启动的时候报错:

Bind port 8080 error: Address already in use

然后 netstat 看:

 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)

我疑惑的是为嘛会出现自己连自己的情况?

nginx 的配置:

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";
    }

相关资料:


楼上的是正解


来,看这篇文章,应该是一样的情况吧

【热门文章】
【热门文章】