Nginx pre-install

I was looking at webserver options on the dietpi and noticed this:

ps -aux | grep nginx

root 1527751 0.0 0.0 10880 6472 ? Ss Feb18 0:00 nginx: master process nginx -g daemon off;
sshd 1527826 0.0 0.0 11332 2580 ? S Feb18 0:00 nginx: worker process
sshd 1527827 0.0 0.0 11332 2580 ? S Feb18 0:00 nginx: worker process
sshd 1527830 0.0 0.0 11332 2580 ? S Feb18 0:00 nginx: worker process
sshd 1527831 0.0 0.0 11332 2580 ? S Feb18 0:00 nginx: worker process

but when checking in the dietpi-software list, it wasn’t actually listed as installed:

What’s the difference with the ps command entires and the non-installed dietpi-software (85)?

Is one default system (and not able to be un-installed) and other is a 2nd install (if installed)?

What would happen to the ps listed one if installing from the software list (85), and/or apache, or some other via apt etc?

on a default system, there is no web server installed.

Check where it is coming from. You should be able to see which port is blocked.

ss -tulpn | grep LISTEN

Did you installed anything else? Any other software? Maybe Docker?

yes there are several installed applications that use a webpage as their GUI, but no native websever was ever setup to run /var/www* pages from the pi. Not sure what the nginx: master does, I can understand the worker processes for the web-access apps, etc…

ss -tulpn | grep LISTEN

lists too many entries, and does mostly point to installed and running software.

systemctl list-unit-files | grep enabled | grep -E ‘(apache2|httpd|nginx)’

shows nothing.

Did you install Docker??? You can run htop to see where the process is coming from. From our side, we don’t install a web server by default. It should have a different reason.

yes, docker is installed with several containers that use webpages for access - (they’d use their own webservers i guess, nginx could be use for them).

I was after a way to clearly identify if the pi had nginx installed or not. (I’m trying to automate the setting up of a reverse proxy nginx since I have several pi’s to roll out to, some of which i wouldn’t know if they already use ngix or not, so scripting to skip if they do etc.)

‘which nginx’ appears to be the easiest way to do this…

Using ps will show Nginx processes from inside the Docker container as well.

As you can see on the following example, Nginx processes are created by the containerd process. Means, they are created by Docker and running inside the container.

You can check if the Debian package for Nginx is installed

1 Like

good call, yes htop will check within containers.

I’ll do a layered check approach and include services as well.

Thanks :slight_smile:

way better would be to check if port 80 is blocked or not. Because every new web server will try to bind to port 80 (default). Means, even your Docker container could prevent installation of an additional web service.

That’s true as part of a check when installing nginx. I just needed to know how to check if nginx was installed to start with or not (default port or not) - it’ll also check for other webservers apache, etc. , then report it (part of a system audit), then depending on a few other things it may (or may not) install if missing (with relevant checks for a successful install, etc.)

Best is to check if the Debian apt package is installed or not.