compiled nginx in ubuntu 16.04

Compiling nginx in ubuntu and want it to work with systemd?

Installed location was /usr/local/nginx/ You'd need to change This is the /lib/systemd/system/nginx.service file and then run # systemctl daemon-reload

Description=The NGINX HTTP and reverse proxy server

ExecStartPre=/usr/local/nginx/sbin/nginx -t
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID


PIDFile will depend on what you put in /usr/local/nginx/conf/nginx.conf (default is log/ so potentially you can just have PIDFile=/usr/local/nginx/log/ Then systemctl start nginx and systemctl status nginx to confirm it running. If you are happy with the results, enable it to make it run on boot systemctl enable nginx



Got comments or issues with what I wrote? Please let me know by submitting an issue with the blog title :)