SoFunction
Updated on 2025-03-03

Summary of several ways to check whether nginx has been started

On Ubuntu or other Linux systems, to see if Nginx is started, you can use one of the following methods:

Method 1: Use the systemctl command

Nginx usually runs as a systemd service, so you can usesystemctlCommand to check its status.

  • Open the terminal.

  • Enter the following command to check the status of the Nginx service:

    sudo systemctl status nginx
    
  • Observe the output. If Nginx is running, you should see something likeactive (running)status information.

Method 2: Use the ps command

You can also usepsCommand to find the Nginx process.

  • Open the terminal.

  • Enter the following command to find the Nginx process:

    ps aux | grep nginx
    
  • Observe the output. If Nginx is running, you should see process information related to Nginx.

Method 3: Check the port

Nginx is usually listened on a specific port (default is 80 and/or 443). You can usenetstatorssCommand to check whether these ports are occupied by Nginx.

  • Open the terminal.

  • Enter one of the following commands to check the port:

    sudo netstat -tulnp | grep nginx
    

    or

    sudo ss -tulnp | grep nginx
    
  • Observe the output. If Nginx is listening for a port, you should see Nginx information related to that port.

Method 4: Access the default page

If Nginx is already configured to provide a default page and you can access the server through your browser, you can try to access the server's IP address or domain name. If Nginx is running and configured correctly, you should see the default welcome page for Nginx.

Please note that some of the above methods may require you to have superuser permissions (usingsudo). Also, if you changed the default configuration or used a different port when installing Nginx, you may need to adjust the checking method accordingly.

Summarize

This is the end of this article about several methods to check whether nginx has been started. For more information about checking whether nginx has been started, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!