Welcome! Log In Create A New Profile

Advanced

nginx systemd reload service command skips configtest

September 26, 2015 05:03PM
Hi, the "nginx.service" file shipped with systemd rpm's both in nginx's stable repository and epel for CentOS7 / RHEL7 do not perform a "configtest" when "systemctl reload nginx" is issued.
So if there is an error in the configuration file nginx is killed but not started due to the faulty configuration.
It's possible to mitigate this in the nginx.service file by having two "ExecReload" commands on separate lines like so:
# grep ExecReload /usr/lib/systemd/system/nginx.service
ExecReload=/usr/sbin/nginx -t
ExecReload=/bin/kill -s HUP $MAINPID

This way if the configtest in the first line fails nginx is never killed, the command does not print any output but that is a systemd issue so I think unavoidable.

I can't guarantee that this is a supported way to do this but it works for me at least :)
Subject Author Posted

nginx systemd reload service command skips configtest

Per Hansson September 26, 2015 05:03PM

Re: nginx systemd reload service command skips configtest

chris-breda September 27, 2015 11:08AM

Re: nginx systemd reload service command skips configtest

nanaya September 27, 2015 11:22AM

Re: nginx systemd reload service command skips configtest

chris-breda September 27, 2015 12:28PM

Re: nginx systemd reload service command skips configtest

Maxim Dounin September 28, 2015 12:08PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 98
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready