How to check whether nginx is started in Linux system

PHPz
Release: 2023-05-17 21:49:10
forward
8515 people have browsed it

First method: View the process list and filter

Every Linux application will generate a process, then we can judge whether the Nginx process is started by checking whether it exists.

Use ps -ef to list the process, and then filter it through grep.

For example: ps -ef | grep nginx You can see whether the Nginx process exists.

Second method: Check the process id directly

ps -C nginx -o pid

This method of directly returning the pid is more suitable for use in conjunction with other programs, such as Execute this command in the shell/python script to get the pid, and then use the pid to determine whether Nginx is started.

It is recommended to use this method.

Third method: Use the netstat command

If our Nginx is running on port 80, then we can use the netstat -anp | grep :80 command to determine whether Nginx is started.

What versions of Linux are there?

Linux versions include: Deepin, UbuntuKylin, Manjaro, LinuxMint, Ubuntu and other versions. Among them, Deepin is one of the best-developed Linux distributions in China; Ubuntu Kylin is a derivative distribution based on Ubuntu; Manjaro is a Linux distribution based on Arch; LinuxMint's default Cinnamon desktop is similar to Windows XP and is simple and easy to use; Ubuntu is a desktop application Mainly Linux operating system.

The above is the detailed content of How to check whether nginx is started in Linux system. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template