I have an NGINX server (used for RTMP) installed on a Raspberry Pi3 running the latest version of Raspbian (as of this writing). I would like to have the NGINX server start automatically when the Pi powers on.
It would seem logical to me that this would have to be done after the user logs in, so I have enabled automatic login for the user foo. However, I have tried adding to /etc/init.d as well as using crontab (
@reboot wait 5; /home/start_server.sh &) as well as adding
pid /var/run/nginx.pid; to the NGINX config file and have had no success in starting the server at boot.
The contents of
start_server.sh are as follows:
When I run the script from the terminal, the server starts up just fine.
I would like to know how to have the NGINX server start at boot. Acceptable answers are [explained] code snippets, [justified] links to tutorials, or any other comprehensible answer.
Thanks for the time in advance!