nginx 无法绑定到端口 80.. 端口 80 上没有任何运行

Noa*_*ark 6 ubuntu nginx web-hosting web-server

我正在尝试在 Ubuntu 11.04 上设置 nginx。我大致遵循了此处找到的说明:http : //library.linode.com/frameworks/sinatra/debian-6-squeeze。我知道它适用于 Debian,但我基本上采取了这些步骤,然后用谷歌搜索“如何在 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()
Run Code Online (Sandbox Code Playgroud)

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

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

在全新的 Ubuntu 安装中看到了Nginx + uWSGI - 绑定错误端口 80并尝试重新启动计算机并运行一次,但出现相同的错误。运行一次后,我运行了 lsof 命令。

更新

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
Run Code Online (Sandbox Code Playgroud)

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    
Run Code Online (Sandbox Code Playgroud)

syb*_*eon 9

一种可能性是,由于某种原因,nginx 两次绑定到端口 80。

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

检查您的 nginx 配置以确保它只绑定一次。

  • 这是对的。我有两个 http 语句。我注释掉了其中之一,现在它开始了。 (2认同)