ruby-on-railsnginx

nginx config file not updating after reload


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;

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?

Thanks in advance


Solution

  • 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.

    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.