How to check if the nginx service is running?

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 in the comments if this helped. Follow me @DevAnswers or buy me a beer 🍺


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

We use Markdown to style comments, like on Github and Reddit.
To do a line break, type two spaces after the sentence.
You can add inline code by wrapping it in backticks: `code here`

    To do an entire block of code  
    type four spaces before the line
    and it will appear in a block like this.
    <-- four empty spaces