3 Commands to stop Nginx Server


If you have an up and running Nginx server on your device and want to stop it, lets see some of the ways you can stop it,

  1. Using systemctl command:
    # systemctl stop nginx
    # sudo systemctl stop nginx
  2. Using service command:
    # service stop nginx
    
    * Stopping nginx nginx [OK]
    # sudo service stop nginx
  3. Using nginx stop command:
    # nginx -s stopx
    # sudo service nginx -s stop

    Note if the service is already stopped, you would see the below message, else the command will return to the prompt.

    # nginx -s stop
    nginx: [error] open() "/run/nginx.pid" failed (2: No such file or directory)
Stop nginx server command
Advertisements
Try Out Code2care Dev Tools:

Advertisements

Advertisements
Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and software developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include learnings, tutorials, trouble-shooting steps, video tutorials, code snippets, how-to, blogs, articles, etc.

🎉 We are celebrating the 10th years of Code2care! Thank you for all your support!

We strongly support Gender Equality & Diversity.