Maurice
Sometimes it can happen that the NGINX configuration is invalid and the NGINX server is restarted with the ploi backend but crashes due to the invalid configuration. This has happened to me mostly due to errors in the LE certification process. Example:
$ nginx -t
nginx: [emerg] cannot load certificate "/etc/letsencrypt/live/site.test/fullchain.pem": BIO_new_file() failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/etc/letsencrypt/live/site.test/fullchain.pem','r') error:2006D080:BIO routines:BIO_new_file:no such file)
nginx: configuration file /etc/nginx/nginx.conf test failed
In this case the solution is simple: delete the problematic LE certificate and recreate it. However, it is not good that the nginx server is unreachable for this time, because all other sites are also unreachable.
Suggestion for a solution: Every NGINX restart should first check the configuration and output any errors instead of restarting like YOLO :)
Dennis
Hi @Morhi ,
What I'd love to know though, is when do you want those NGINX tests to run exactly? When you manually reboot the NGINX service for example?
Maurice
Item authorHi @Dennis!
Thanks for looking into this. Yes, one thing would be a manual restart under [Server] > Manage > Restart NGINX
. I do this after editing the NGINX configurations for a particular site. I am not sure if there are automatic restarts? Maybe after creating or editing an SSL configuration?
I'm just noticing that there seems to be a new feature, because I can now test the configuration after editing the NGINX configuration files, which is nice! However, if the configuration is invalid, it shows me the line number, but there are no line numbers in the file editor, so it would be nice to have that too. Just as a side note ;) So it seems to me that a manual restart is the only place where it would be nice to be able to check it first.
Philippe Aellig
Hi @Dennis i tested the automatic nginx restart behavior. Nginx will restart after add domain alias and add ssl certificates. i would love it to have the nginx config tests before these restarts and next to the manual restart button on server level.
Keep NGINX from crashing when config is invalid
-
Dennis moved item to board Planned
1 year ago -
Dennis moved item to board Under review
2 years ago -
Maurice moved item to project Server Level Requests
2 years ago -
Maurice created the item
2 years ago