加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 运营中心 > Nginx > 正文

ubuntu – nginx无法绑定到端口80 ..没有在端口80上运行

发布时间:2020-12-13 21:40:08 所属栏目:Nginx 来源:网络整理
导读:我正在尝试在Ubuntu 11.04上设置nginx.我按照这里的大致指示:http://library.linode.com/frameworks/sinatra/debian-6-squeeze.我知道这是针对Debian的,但我基本上采取了这些步骤然后用Google搜索“如何在ubuntu 11.04中执行x”虽然我确实从他们的库中提取

我正在尝试在Ubuntu 11.04上设置nginx.我按照这里的大致指示:http://library.linode.com/frameworks/sinatra/debian-6-squeeze.我知道这是针对Debian的,但我基本上采取了这些步骤然后用Google搜索“如何在ubuntu 11.04中执行x”虽然我确实从他们的库中提取了init脚本.

Starting nginx: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()

命令:’sudo lsof -i:80’不返回端口80上运行的任何内容.

我如何解决这个或任何可能出错的想法?

我看到Nginx + uWSGI on a fresh Ubuntu install – bind error port 80并尝试重新启动计算机并运行一次,我得到了同样的错误.运行一次之后,我运行了lsof命令.

UPDATE

sudo netstat -ltnp返回:

  Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address  
     Foreign Address         State       PID/Program name 

  tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1998/sshd  

  tcp6       0      0 :::22                 :::*                    LISTEN      1998/sshd

nestat -a返回:

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 *:ssh                   *:*                     LISTEN     
tcp        0    176 matterhorn.noahc.ne:ssh 173-26-190-206.cl:26467 ESTABLISHED
tcp6       0      0 [::]:ssh                [::]:*                  LISTEN      
udp        0      0 matterhorn.noahc.:35332 10504.x.rootbsd.net:ntp ESTABLISHED
udp        0      0 matterhorn.noahc.:53298 tick.tadatv.com:ntp     ESTABLISHED
udp        0      0 matterhorn.noahc.:54371 ns1.baribault.net:ntp   ESTABLISHED
udp        0      0 matterhorn.noahc.:38304 tardis.chpc.utah.ed:ntp ESTABLISHED
Active UNIX domain sockets (servers and established)

Proto RefCnt Flags       Type       State         I-Node   Path
unix  2      [ ACC ]     STREAM     LISTENING     684      @/com/ubuntu/upstart
unix  2      [ ]         DGRAM                    730      @/org/kernel/udev/udevd
unix  6      [ ]         DGRAM                    4316     /dev/log
unix  2      [ ]         DGRAM                    11447    
unix  3      [ ]         STREAM     CONNECTED     10466    
unix  3      [ ]         STREAM     CONNECTED     10465    
unix  2      [ ]         DGRAM                    11411    
unix  3      [ ]         STREAM     CONNECTED     2958     
unix  3      [ ]         STREAM     CONNECTED     2957     
unix  2      [ ]         DGRAM                    4518     
unix  2      [ ]         DGRAM                    2902     
unix  2      [ ]         DGRAM                    2614     
unix  3      [ ]         STREAM     CONNECTED     1284     @/com/ubuntu/upstart
unix  3      [ ]         STREAM     CONNECTED     4131     
unix  3      [ ]         DGRAM                    733      
unix  3      [ ]         DGRAM                    732      
unix  3      [ ]         STREAM     CONNECTED     1038     @/com/ubuntu/upstart
unix  3      [ ]         STREAM     CONNECTED     2088    
最佳答案
一种可能性是,由于某种原因,nginx两次绑定到端口80.

如果它试图这样做,它将失败.一个例子可能是绑定到IPV6和IPV4,或者绑定到公共IP和通配符ip.

检查你的nginx配置,确保它只绑定一次.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读