Javascript required
Skip to content Skip to sidebar Skip to footer

Failed to Start Startup Script for Nginx Service

Failed to Start Startup Script for Nginx Service

Introduction

Nginx is a powerful server application that routes network traffic. It'due south often used as a reverse proxy server, but tin besides be configured every bit a regular web server.

One of the almost mutual operations you volition see is starting, stopping, and restarting the Nginx web server.

In this tutorial, learn how to start, cease, and restart the Nginx service.

Commands to stop, start, and restart Nginx in linux

Prerequisites

  • A system with Nginx installed and configured
  • Access to a final window or control line
  • A user account withsudo orroot privileges
  • An existing SSH connection to a remote organisation (if yous're working remotely)

Start, Stop, and Restart Nginx with systemctl

How to View Status of Your Nginx Server

Nginx runs equally a service on your server. That means that it should be actively running in the groundwork, fifty-fifty if you don't see anything on the screen. Y'all can brandish the status of the Nginx service by entering the following command in a final window:

          sudo systemctl status nginx        

The system will switch into a condition mode, displaying lots of information virtually the Nginx service.

  • If the service is running (agile), y'all'll run across a green active (running) condition in the third line.
  • If Nginx is not running, it will display asinactive in standard white.
  • If something went wrong and Nginx couldn't load, you'll encounter a red statusfailed, with some information about the failure.
Checking the status of an Nginx webserver in terminal

Press q to reactivate the fustigate prompt.

SystemD is the default service director on modern versions of Linux distributions (Ubuntu xx.04/18.04/16.04, CentOS seven/7, and Debian 9/10 ). The SystemD director functions through the systemctl command.

The systemctl control is a base Linux control. That means that it can exist used for any Linux service.

Stop and Offset Nginx

systemctl can be used to get-go and stop the Nginx service.

To terminate Nginx, run the following command:

          sudo systemctl end nginx        
Terminal command to stop an Nginx web server

To first Nginx, execute the systemctl command with the first choice:

          sudo systemctl start nginx        
systemctl command to start the Nginx service

How to Restart Nginx

Gracefully Restart Nginx

If yous're refreshing Nginx after irresolute the configuration, it's all-time to gracefully reload the service. That shuts downward erstwhile processes and restarts new ones with the new configuration.

Employ the systemctl Linux control to reload the Nginx service. Run the following command:

          sudo systemctl reload nginx        

Annotation: Nginx cannot exist reloaded if the the Nginx service is not active.

Force Restart Nginx

For major configuration changes, you can force a full restart of Nginx. This strength-closes the whole service and sub-processes, and restarts the whole package.

Enter the following control:

          sudo systemctl restart nginx        

Restart vs Reload Nginx

The reload control keeps the Nginx server running every bit it reloads updated configuration files. If Nginx notices a syntax error in any of the configuration files, the reload is aborted and the server keeps running based on old config files. Reloading is safer than restarting Nginx.

The restart command volition shut down the server including all related services and power it on over again. Restart Nginx only when making significant configuration updates, such as changing ports or interfaces. This control will strength shut down all worker processes.

Configure Nginx to Launch on Boot

Use the enable choice with the systemctl control to enable Nginx:

          sudo systemctl enable nginx        

Use the disable choice with the systemctl command to disable Nginx:

          sudo systemctl disable nginx        

Start, End, and Reload Nginx with the Nginx Control

Nginx has a set of congenital-in tools for managing the service that tin exist accessed using the Nginx command.

Nginx Start

To start Nginx and related processes, enter the following:

          sudo /etc/init.d/nginx start        

If run successfully, the terminal output will display the following:

          Output [ ok ] Starting nginx (via systemctl): nginx.service.        

Nginx Restart

To force close and restart Nginx and related processes:

          sudo /etc/init.d/nginx restart        
Restart nginx with nginx restart command.

As an culling, use the nginx -s command:

          sudo nginx -south restart        

Nginx Cease

To disable or finish the Nginx service, enter the following:

          sudo /etc/init.d/nginx cease        
Stop the Nginx service with the nginx stop command

Alternatively, use:

          sudo nginx -south stop        

Nginx Reload

To gracefully finish and restart Nginx and related processes, employ the command:

          sudo /etc/init.d/nginx reload        
Reload Nginx with in-built Nginx reload command.

Alternately, you can employ the nginx -south command to pass instructions directly to Nginx:

          sudo nginx -s reload        

Nginx Quit

Force close the Nginx service by using the quit educational activity with the nginx -s command:

          sudo nginx -south quit        

Determination

This article has outlined several methods to showtime, stop, and restart Nginx on your server. Use these commands for the most common operations when managing an Nginx web server.

Was this commodity helpful?

Yes No

Failed to Start Startup Script for Nginx Service

Posted by: dunkinfousee1994.blogspot.com