nginx - 添加 nginx 作为 ubuntu 服务停止并重新加载不起作用

标签 nginx init.d

我的nginx是从源代码编译的,只给出--conf-path=/etc/nginx/nginx.conf

的标志

一切正常,我试图使用 this service init.d脚本使nginx成为系统服务,

这是我只做了 2 个小改动的脚本:

1. DAEMON=/usr/local/nginx/sbin/nginx

2.NGINX_CONF_FILE="/etc/nginx/nginx.conf"

然后sudo服务nginx启动

有效

yozloy@SNDA-172-17-10-158:/usr/local$ sudo service nginx start
 * Starting Nginx Server...
   ...done

.

但是服务 nginx 停止并重新加载服务 nginx

给我一​​个错误

yozloy@SNDA-172-17-10-158:/usr/local$ sudo service nginx stop
 * Stopping Nginx Server...
   ...fail!

并且错误不会出现在 log/error.log 文件中

最佳答案

我在 Ubuntu 12.04 上使用 Nginx 时遇到了类似的问题,nginx 从源代码编译,init 脚本取自与您类似的源。

服务通过 init 文件启动良好,但停止或重新启动却失败。 最终原因是 nginx.conf 和 init 脚本中 pid 文件的路径不同。 确保它们都指向同一位置。

关于nginx - 添加 nginx 作为 ubuntu 服务停止并重新加载不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10939072/

相关文章:

django.request : Forbidden (Referer checking failed - no Referer. )

docker - Nginx 上游不适用于 docker 部署堆栈

php - 超过 1.5GB 时,JQuery 文件上传到 NGINX/PHP 服务器失败

shell - Aria2 工作初始化脚本

linux - init.d 脚本停止 echo 管道到 grep 输出到终端

nginx - 如何使用现有 NGINX 安装启用动态模块

nginx - 将请求重定向到https会中断Stripe Webhook

mysql - 找不到 mysql 进程的最大打开文件数(ulimit)的来源

linux - dpkg remove 以停止进程

centos - 在 Centos 6.5 上以不同的用户或服务帐户运行 filebeat