AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 483432
Accepted
user974407
user974407
Asked: 2013-03-01 06:47:44 +0800 CST2013-03-01 06:47:44 +0800 CST 2013-03-01 06:47:44 +0800 CST

Nginx 未运行。没有收到任何错误

  • 772

如果我跑:

$ sudo service nginx status
* nginx is not running

然后我跑:

$ sudo service nginx start
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] still could not bind()

所以我杀了它:

sudo fuser -k 80/tcp

所以我尝试再次启动 Nginx:

$ sudo service nginx start
Starting nginx: nginx.

现在应该正在运行,对吧?:

$ sudo service nginx status
* nginx is not running

我试过了:

$ ps aux | grep nginx
root      1316  0.0  0.2  64988  1236 ?        Ss   14:37   0:00 nginx: master process /usr/sbin/nginx
nobody    1317  0.0  0.3  65408  1908 ?        S    14:37   0:00 nginx: worker process
myusername     1436  0.0  0.1   9388   876 pts/2    S+   14:40   0:00 grep nginx

当我访问该站点的 ip 时。nginx/1.2.1我在底部收到一条 404 消息。在我看来,它实际上正在运行。我在 nginx.conf 中阻止了 ip 地址,我测试了这些 ip 目前正在被阻止。所以我对 Nginx 是否正在运行以及如何抓住这个野兽感到困惑。
我的最终目标是让 Gunicorn 也能运行。奇怪的是这一切昨天都在工作。Gunicorn 和 Nginx 的状态均为working.

nginx
  • 3 3 个回答
  • 2579 Views

3 个回答

  • Voted
  1. Best Answer
    Sc0rian
    2013-03-01T07:13:34+08:002013-03-01T07:13:34+08:00

    404 = 找不到页面。

    这意味着 nginx 正在为请求提供服务(同时你没有在端口 80 上运行任何其他东西)。从它的声音来看,服务器已经正常启动。只需在您的 nginx 目录根目录中使用“hello world”创建一个 index.htm 文件,然后您就会看到一些东西。

    • 1
  2. marcodv
    2013-03-01T09:11:16+08:002013-03-01T09:11:16+08:00

    也许您在同一端口上运行了 apache,而 nginx 无法绑定该地址,因为它已被使用。
    要更改 nginx 的端口,请查看 stackoverflow 上的回复 [1] https://stackoverflow.com/questions/10829402/how-to-start-nginx-via-different-portother-than-80

    这里有一个关于我的哈巴狗的例子

    marco@BeastFMM:~$ sudo service nginx start
    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()
    nginx.
    marco@BeastFMM:~$ sudo /etc/init.d/apache2 stop
    sudo: unable to resolve host BeastFMM
     * Stopping web server apache2                                                                                                                                   apache2: apr_sockaddr_info_get() failed for BeastFMM
    apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
     ... waiting                                                                                                                                              [ OK ]
    marco@BeastFMM:~$ sudo service nginx start
    Starting nginx: nginx.
    marco@BeastFMM:~$ ps aux | grep nginx
    root      7986  0.0  0.0  78976  1288 ?        Ss   17:07   0:00 nginx: master process /usr/sbin/nginx
    www-data  7987  0.0  0.0  79316  1708 ?        S    17:07   0:00 nginx: worker process
    www-data  7988  0.0  0.0  79316  1708 ?        S    17:07   0:00 nginx: worker process
    www-data  7989  0.0  0.0  79316  1708 ?        S    17:07   0:00 nginx: worker process
    www-data  7990  0.0  0.0  79316  1708 ?        S    17:07   0:00 nginx: worker process
    
    • 1
  3. gxtr
    2013-03-01T09:01:50+08:002013-03-01T09:01:50+08:00

    您是否更改了 pid 文件的位置?通常,当您启动服务时,它会检查它是否已经在运行,如果是则不执行任何操作,否则将启动它。所以你得到的那些绑定错误不应该发生。

    vinit 的 nginx pid 文件的默认位置是 /var/run/nginx.pid。

    • 0

相关问题

  • Gzip 与反向代理缓存

  • nginx 作为代理的行为

  • Nginx 学习资源 [关闭]

  • 提供 70,000 个静态文件 (jpg) 的最佳方式?

  • 在 Apache、LightTPD 和 Nginx Web 服务器上提供 PHP 5.x 应用程序的现状?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve