Home > Operation and Maintenance > Nginx > Check whether nginx is started

Check whether nginx is started

藏色散人
Release: 2019-10-24 11:50:38
Original
23077 people have browsed it

Check whether nginx is started

Check whether nginx is started?

Below I will share the process record of checking whether Nginx is started in Linux.

Recommended: "Nginx Tutorial"

Judge by process

The first method: View the process list and filter

Every Linux application will generate a process, so we can determine whether it is started by checking whether the Nginx process 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
Copy after login

This method of directly returning the pid is more suitable for use in conjunction with other programs, such as executing this command in a 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.

Judge by port

The third method: use the netstat command

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

Fourth method: Use the lsof command

lsof -i:80 You can also check whether there is a process running on port 80.

The above is the detailed content of Check whether nginx is started. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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
Latest Issues
Error restarting nginx
From 1970-01-01 08:00:00
0
0
0
server - Nginx configuration webapp problem
From 1970-01-01 08:00:00
0
0
0
Nginx default.conf problem
From 1970-01-01 08:00:00
0
0
0
centos7 - NGINX exception occurs
From 1970-01-01 08:00:00
0
0
0
nginx load balancing
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template