Nginx – Launch Nginx on startup

nginxstartupUbuntu

I was able to install and run nginx, and passenger but i'm not able to have nginx come up whenever i reboot my server. To start the nginx process i just type in sudo /opt/nginx/sbin/nginx. From my understanding anything i put in /etc/init.d with ubuntu hardy will be execute. Does anyone know the command that will mimic this command line call?

sudo /opt/nginx/sbin/nginx

Best Answer

To start nginx on boot: sudo systemctl enable nginx (doesn't start it immediately)

To start nginx: sudo systemctl start nginx