-
-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test nginx config on SIGHUP #206
Comments
Hi stefansundin, Before diving deeper into this I must ask what changes to the config were made in order to break Nginx. I was under the impression that if Nginx has managed to load a valid config once it will just print an error if presented with a new erroneous config after a reload. The exception here is probably if there are missing files or similar. I am therefore not entirely sure what benefit including this check in the reload would provide, since it is intended more for the administrator to review its output to catch any obvious errors. The SIGHUP function here is just an automatic process which will basically never be inspected by a human until something goes wrong and then most of the stuff would already be in the error log. So I am not rejecting this idea, it is just that we probably need to better specify what the actual issue is and what you want to solve. :) |
Hello again, thanks for getting back to me :)
Unfortunately that does not seem to be the case. Here's an example of a mistake I just made: I wanted to add a
Hopefully this is enough information. Please let me know if there's anything else you need. If you agree that a config test should be added but you don't have time to add it yourself then I can give it a try. |
Sorry, yes, I am a little bit busy this week so I apologize for the slow responses. However, I am sitting here thinking about the change and I am not sure this should be included in the SIGHUP loop. I feel like this automatic loop needs to be able to draw attention to itself in case something is significantly wrong, and a container restart is about as clear it get that manual intervention is necessary. Would it perhaps be better to add this check to another signal, or just execute the check manually (in order to see the result directly)
|
Hmm. I can't say I agree but you should do what you think it best, of course. :) In my personal opinion the logs are the standard way for a program to communicate with the administrator what is going on. I don't know if it needs to be terribly different from running nginx as a systemctl service. It appears that the nginx systemctl service does what you originally thought, check the config before actually performing the reload. Not sure if all distributions use this config though, I wouldn't be surprised if some modify it.
|
Hello,
It would be great if the nginx config could be tested with
nginx -t
when SIGHUP is received. I messed up my config and the result was (unsurprisingly) that the whole docker container died. I think it would be great if it just printed the output fromnginx -t
and didn't actually reload nginx in this case.Thanks for a great project!
The text was updated successfully, but these errors were encountered: