How to Check The Version of Nginx

I’m running Nginx within a docker container and I was on a quest to make sure it wasn’t running as the root user. So the first thing I wanted to do was check the version of Nginx because I’ve read that it doesn’t run as root if the version is >1.12.1-r2. Source is just a github thread.

So I log into the nginx container via docker exec -it nginx bash and run nginx -v. This gives me the following output:

nginx version: nginx/1.17.8

That’s all I need to know. Of course after running this I ran ps aux | grep nginx to get this output:

bash-5.0# ps aux | grep nginx
    1 root      0:00 nginx: master process nginx -g daemon off;
    6 root      0:00 /bin/sh -c while :; do sleep 6h & wait ${!}; nginx -s reload; done & nginx -g "daemon off;"
   20 www-data  0:00 nginx: worker process
   21 www-data  0:00 nginx: worker process
   22 www-data  0:00 nginx: worker process
   23 www-data  0:00 nginx: worker process
   33 root      0:00 grep nginx

This showed me that the workers are running under www-data but not the main master process, so I’ll have to fix that (coming in another blog post shortly)

If you found this post helpful, please share on social media and thanks for reading!

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.