【问题标题】:nginx not starting on bootnginx没有在启动时启动
【发布时间】:2016-05-10 22:42:01
【问题描述】:

我该怎么办

sudo update-rc.d nginx defaults

展示

System start/stop links for /etc/init.d/nginx already exist.

但 nginx 仍然无法在重启时启动?

【问题讨论】:

  • 它的默认行为是在启动时启动,并且该文件应该在那里。你确定它不启动? nginx -t 有问题吗? service nginx restart 怎么样?
  • # nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful nginx 在我手动启动后工作正常。每次我都必须通过 ssh 登录并运行 service nginx start,但这显然并不理想。
  • 我在 AWS 上运行 Ubuntu Server 14.04 EC2 AMI
  • 请看一下nginx日志。您确定在启动时没有绑定端口 80 吗?可能是您在 NGINX 尝试启动之前绑定了端口 80 的其他 Web 服务器。
  • 在 Digital Ocean 上的 Ubuntu 14.04 x64 Droplet 上遇到同样的问题。 nginx 日志文件中没有错误。

标签: ubuntu nginx ubuntu-14.04


【解决方案1】:

我知道这个命令适用于 Centos。对 Ubuntu 不太确定。不过值得一试:

chkconfig nginx 开启

任何服务的语法都是一样的

chkconfig httpd on

希望有效果

【讨论】:

    【解决方案2】:

    首先检查一般情况下启动 nginx 没有问题。

    vi /var/log/nginx/error.log
    

    然后检查是否可以使用启动服务启动 nginx 并且它正在运行

    service nginx start ; ps -ef | grep nginx
    

    然后仔细检查启动脚本是否存在并正常工作。

    cd /etc/init.d ; vi nginx*
    

    希望对你有帮助

    【讨论】:

    • 服务“服务 nginx 启动;ps -ef | grep nginx”不工作。我使用configure make make install安装了nginx,可能有些东西的安装方式与apt-get install nginx不同?我能做些什么来解决这个问题?
    • 是的,如果你从源代码编译它会有所不同。本文档应该对您有所帮助。 sharadchhetri.com/2015/02/21/…
    猜你喜欢
    • 2014-08-06
    • 1970-01-01
    • 1970-01-01
    • 2015-10-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-07
    • 2016-08-16
    相关资源
    最近更新 更多