I compiled Nginx from source code and now I want to manage it via systemd like systemctl start,stop,restart,reload,enable nginx.service
. What I need to do to enable this ?
I compiled Nginx from source code and now I want to manage it via systemd like systemctl start,stop,restart,reload,enable nginx.service
. What I need to do to enable this ?
You'll need to add NGINX systemd service file in
/lib/systemd/system/nginx.service
.For your own instance of Nginx (vs. the one provided by your distribution)
/etc/systemd/system/nginx.service
could be correct location. It also overrides/lib/systemd/system/nginx.service
, when enabled withsystemctl enable nginx.service
(orreenable
).You may need to change the paths depending on where the Nginx you have compiled is located. Here, I assume it's in
/usr/local/sbin/nginx
.