大网数据广告活动
服务器运维问答

different behavior between `/etc/init.d/nginx start` and `nginx`

· 52CE 我爱测

I got my /etc/init.d/nginx init script from here: https://www.nginx.com/resources/wiki/start/topics/examples/redhatnginxinit/ in my /etc/nginx/nginx.conf , there's include /etc/nginx/conf.d/*.conf; which includes the config files…

问题原文

原帖链接 · wong2 · CC BY-SA 3.0

I got my /etc/init.d/nginx init script from here: https://www.nginx.com/resources/wiki/start/topics/examples/redhatnginxinit/

in my /etc/nginx/nginx.conf, there's include /etc/nginx/conf.d/*.conf; which includes the config files of my website.

however, after /etc/init.d/nginx start, it seems nginx is not loading those config files, and it returns 502 on access.

on the other hand, start nginx with command nginx works just fine.

what's wrong here?

已采纳解答

原帖链接 · Alexander Tolkachev · CC BY-SA 3.0

Looks like your problem with wrong init file. Usually nginx install it from RPM and no additional files required. In your link metioned, that it init file tested on CentOS 5, but you using CentOS 6, where it not tested. Try to remove this init file and reinstall nginx from RPM or repo, it should install good one init file.

If you don't want to do it, you could try to copy init file from there. It's copy of init file from installed on CentOS 6 nginx.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-07-20)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。