笔记---Nginx报错问题的处理记录

Nginx报错问题的处理记录


问题1

服务器上的nginx服务突然报错,导致网站应用都挂掉了。

1.1 报错描述

重启nginx报错信息:

Starting A high performance web server and a reverse proxy server... 
Sep 18 09:03:04 ubuntu nginx[139928]: nginx: [emerg] unknown directive "passenger_root" in /etc/nginx/conf.d/mod-http-passenger.conf:2 
Sep 18 09:03:04 ubuntu nginx[139928]: nginx: configuration file /etc/nginx/nginx.conf test failed 
Sep 18 09:03:04 ubuntu systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE Sep 18 09:03:04 ubuntu systemd[1]: nginx.service: Failed with result 'exit-code'. 
Sep 18 09:03:04 ubuntu systemd[1]: Failed to start A high performance web server and a reverse proxy server. 
Sep 18 09:04:42 ubuntu systemd[1]: nginx.service: Unit cannot be reloaded because it is inactive.

执行 sudo nginx -t 错误信息:

nginx: [emerg] unknown directive "passenger_root" in /etc/nginx/conf.d/mod-http-passenger.conf:2 
nginx: configuration file /etc/nginx/nginx.conf test failed

1.2 处理方法

1. 重新安装passenger相关

sudo apt-get install -y libnginx-mod-http-passenger

2. 检查nginx配置并重启nginx

# 检查nginx配置
sudo nginx -t

# 输出
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

# 重启nginx服务
sudo /etc/init.d/nginx start

参考链接:https://stackoverflow.com/questions/21840707/nginx-unknown-directive-for-passenger-root

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值