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

问题

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

1.启动Nginx时一直卡着不动在 Starting nginx (via systemctl),实际端口是开启了,必须通过Ctrl + C强制关闭
2.关闭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.

原因

/usr/local/nginx/conf/nginx.conf 中的 pid 位置 和 /etc/init.d/nginx 中 pid 位置配置不一样
修改PID文件路径即可解决上面问题
解决:修改/etc/init.d/nginx 配置的PID文件路径和nginx.conf文件中的PID路径一致

/etc/init.d/nginx

/usr/local/nginx/conf/nginx.conf

相关文章

转载请注明: 转载自 浮生一程
本文链接地址 Centos7 配置systemctl的Nginx启动服务,start一直卡着,stop不生效
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇