How to verify if nginx is running or not? How to verify if nginx is running or not? nginx nginx

How to verify if nginx is running or not?


Looking at the requirement you have, the below command shall help:

service nginx status


This is probably system-dependent, but this is the simplest way I've found.

if [ -e /var/run/nginx.pid ]; then echo "nginx is running"; fi

That's the best solution for scripting.


You could use lsof to see what application is listening on port 80:

sudo lsof -i TCP:80