0
点赞
收藏
分享

微信扫一扫

Centos7 配置systemctl的Nginx启动服务,start一直卡着,stop不生效

沐之轻语 2022-02-18 阅读 74

目录

  • 问题:Centos7 配置systemctl的Nginx启动服务,start一直卡着,stop不生效
  • 解决:修改/etc/init.d/nginx 配置的PID文件路径和nginx.conf文件中的PID路径一致

问题:Centos7 配置systemctl的Nginx启动服务,start一直卡着,stop不生效

发现以下问题

  • 启动Nginx时一直卡着不动在 Starting nginx (via systemctl):

    • 实际端口是开启了

    • 必须通过Ctrl + C强制关闭

  • 关闭Nginx时,提示成功,但是端口没关闭

查看Nginx 状态日志如下

[root@xxx nginx-1.17.2]# systemctl status nginx
● nginx.service - SYSV: Nginx is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 proxy server
Loaded: loaded (/etc/rc.d/init.d/nginx; bad; vendor preset: disabled)
Active: inactive (dead) since Thu 2019-08-08 05:37:04 EDT; 2min 15s ago
Docs: man:systemd-sysv-generator(8)
CGroup: /system.slice/nginx.service
├─21402 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
└─21403 nginx: worker process

Aug 08 05:36:50 10-0-94-90 systemd[1]: Starting SYSV: Nginx is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 proxy server...
Aug 08 05:36:50 10-0-94-90 nginx[21393]: Starting nginx: [ OK ]
Aug 08 05:36:50 10-0-94-90 systemd[1]: PID file /usr/local/nginx/logs/nginx.pid not readable (yet?) after start.
Aug 08 05:37:04 10-0-94-90 systemd[1]: Stopped SYSV: Nginx is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 proxy server.

如上PID文件位置不对,修改PID文件路径即可解决上面问题

解决:修改/etc/init.d/nginx 配置的PID文件路径和nginx.conf文件中的PID路径一致

举报

相关推荐

0 条评论