Home >Operation and Maintenance >Nginx >Is nginx starting?
Each application running in Linux will generate a process, so we can determine whether the Nginx process has started by checking whether it exists.
1. Sometimes if you want to know whether nigix is running normally, you need to use linux commands to check the running status of nginx. Execute command: ps -A | grep nginx.
If the result is returned, it means nginx is running and the service has been started. (Recommended learning: nginx tutorial )
If you are not afraid of Nginx closed. You can also execute: service nginx restart.
Restart the nginx service. During the restart, you can also see if there are any specific errors.
2. Check the port netstat -ntlp;
Check the process ps -ef|grep nginx;
Check whether the log is updated tail -f access. log.
3. Check the process id directly: ps -C nginx -o pid.
This method of directly returning the pid is more suitable for use in combination with other programs. For example, execute this command in a shell/python script to get the pid, and then use the pid to determine whether Nginx is started. This method is recommended.
The above is the detailed content of Is nginx starting?. For more information, please follow other related articles on the PHP Chinese website!