Fix Ubuntu ( nginx: unrecognized service )

Discussion in 'Linux' started by securityhope, Nov 10, 2016.

  1. securityhope

    securityhope Administrator Staff Member

    Joined:
    Aug 3, 2016
    Messages:
    1,241
    Likes Received:
    0
    Trophy Points:
    36
    The seventh step manually starts nginx:

    sudo service nginx start

    but fails with the following error:

    nginx: unrecognized service

    Answers

    The nginx: unrecognized service error means the startup scripts need to be created.
    Fortunately the startup scripts have already been written.

    We can fetch them with wget and set them up following these steps:

    Code:
    # Download nginx startup script
    wget -O init-deb.sh https://www.linode.com/docs/assets/660-init-deb.sh
    
    # Move the script to the init.d directory & make executable
    sudo mv init-deb.sh /etc/init.d/nginx
    sudo chmod +x /etc/init.d/nginx
    
    # Add nginx to the system startup
    sudo /usr/sbin/update-rc.d -f nginx defaults
    Now we can control nginx using:

    Code:
    sudo service nginx stop
    sudo service nginx start
    sudo service nginx restart
    sudo service nginx reload
     

Share This Page

Share