linux - Nginx 服务器没有重启

标签 linux nginx google-cloud-platform debian

我正在使用这个 instance image来自谷歌云平台市场。此实例来自 Jetware #jetware .

服务器配置了负载均衡器、反向代理和http缓存。

我想安装需要我重新启动 nginx 服务器的 SSL 证书。

我通过执行以下命令来做到这一点:

sudo systemctl restart nginx

我收到以下错误:

Failed to restart nginx.service: Unit nginx.service not found.

当我运行这个命令来检查 nginx 的状态时:

sudo systemctl status nginx.service

我收到以下消息:

Unit nginx.service could not be found.

然后我运行了这个:

nginx -t

我收到以下消息:

nginx: the configuration file /jet/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /jet/etc/nginx/nginx.conf test is successful

我进一步运行了这个:

ps -aux | grep nginx

得到如下输出:

<logged in user id>    1259  0.0  0.1  91720  1548 ?        Ss   06:46   0:00 nginx: master process /jet/bin/nginx
<logged in user id>    1262  0.0  0.4  92184  4748 ?        S    06:46   0:00 nginx: worker process
<logged in user id>    3329  0.0  0.2  10984  2272 pts/0    S+   08:07   0:00 grep nginx

那么为什么nginx没有重启,有没有办法重启nginx?

最佳答案

我在 Xubunut 18.04 上,这对你来说可能 1:1 不起作用) 启动你的 nginx 的服务不叫 nginx。你手动启动nginx了吗?我认为这与其说是 nginx 问题不如说是系统问题。 => 你需要找到哪个服务启动了 nginx

systemctl status $(pidof nginx)

如果它保持为空,则表示没有使用服务启动 nginx。您可以创建一个或应该能够从您的发行版中获得一个。
如果这显示一个列表,您可以检查(或简单地尝试)哪一个是正确的重启(在我的系统上一些子进程也被打印)

一些信息:
https://unix.stackexchange.com/questions/225802/finding-systemd-unit-owning-a-running-daemon-process https://serverfault.com/questions/692771/find-the-location-of-a-systemd-service

关于linux - Nginx 服务器没有重启,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55116894/

相关文章:

linux - 在单个 Linux 机器上模拟网络跃点

C编程调用FILE *variable

linux - 如何在 Altera 嵌入式命令 Shell 中以 "root user"身份登录?

python - 区分nginx、haproxy、varnish和uWSGI/Gunicorn

php - 在 nginx 中运行 PHP 的虚拟目录

javascript - 未在 process.env 中定义的 Firebase secret

MYSQL 无法启动

html - 如何使用自定义位置或路径代替 root 用于使用 nginx 的多个应用程序?

google-cloud-platform - Gcloud 构建提交失败 "global"违反约束 "constraints/gcp.resourceLocations"

google-app-engine - Terraform:创建 App Engine 应用程序时出错:googleapi:错误 403:调用方没有权限,禁止