重新加载后nginx配置文件未更新 [英] nginx config file not updating after reload

查看:124
本文介绍了重新加载后nginx配置文件未更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 nginx 配置文件中有一个重写重定向列表.我正在尝试删除一个重定向,但没有任何乐趣:

I have a list of rewrite redirects in my nginx config file. There is one redirect that I'm trying to remove without any joy:

rewrite ^/bla/screening-tools$ /bla permanent;

我试过简单地删除这一行,然后运行

I've tried simply removing this line, and then running

sudo nginx -s reload

但是它仍然存在.我试过把它留在里面,然后在最后再次重写它:

However it is still there. I've tried leaving it in and then rewriting it once more at the end:

rewrite ^/bla/screening-tools$ /bla/screening-tools permanent;

然而,在重新加载 nginx 后,这仍然没有效果.我错过了一些明显的东西吗?我需要手动停止和重新启动 nginx 吗?

However once more after reloading nginx this still has no effect. Am I missing something obvious? Do I need to manually stop and restart nginx?

提前致谢

推荐答案

如果您的新配置失败,它将使用旧配置.你能检查你的错误日志,看看新配置是否成功?如果正在重新配置,您应该看到一个[notice] 1#1: reconfiguring 注释,如果重新配置成功,您应该看到旧的worker 优雅地关闭,如[notice] 7#7:优雅地关闭.如果失败,您可能会看到一些 [emerg] 消息.

If your new configuration fails, it will use the old configuration. Can you check your error logs to see if the new configuration is successful? If it is reconfiguring, you should see a [notice] 1#1: reconfiguring note, and if it successfully reconfigured, you should see the old workers gracefully shutting down, like [notice] 7#7: gracefully shutting down. If it fails, you may see some [emerg] message.

另外,您可能想尝试的另一件事是添加 nginx -s reload -c/path/to/nginx.conf 以确保它正在读取正确的文件.

Also, another thing you may want to try is adding nginx -s reload -c /path/to/nginx.conf to make sure it is reading the right file.

这篇关于重新加载后nginx配置文件未更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆