How to check if the nginx service is running?

Last updated on

To find out if nginx is running or not, run the following command

service nginx status
 nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2018-02-14 23:53:45 CET; 6 days ago
  Process: 20659 ExecReload=/usr/sbin/nginx -g daemon on; master_process on; -s reload (code=exited, status=
 Main PID: 20569 (nginx)
    Tasks: 2
   Memory: 26.2M
      CPU: 5min 48.358s
   CGroup: /system.slice/nginx.service
           ├─20569 nginx: master process /usr/sbin/nginx -g daemon on; master_process on
           └─20663 nginx: worker process

You can also try:

ps waux | grep nginx

If it’s running, you should see

root      1663  0.0  0.2 125104  1492 ?        Ss   14:53   0:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process  on;
www-data  1670  0.0  0.6 125412  3208 ?        S    14:53   0:00 nginx: worker process
username  2012  0.0  0.2  12944  1008 pts/0    S+   15:11   0:00 grep --color=auto nginx

Let me know if this helped. Follow me on Twitter, Facebook and YouTube, or 🍊 buy me a smoothie.

Leave a reply

Your email address will not be published. Required fields are marked *