1

Apologies, but I'm a relative newbie to RPi & nginx.

I was having an issue with nginx on my Raspberry Pi 3B, and for some reason I thought it would be a good idea to remove and re-install it.

Before I removed it the files were located where I expected them to be, ie /etc/nginx. After I re-installed the files are seemingly all over the place (/usr/lib/nginx, /var/lib/nginx etc).

I Googled for articles on installing nginx on RPi and all seem to indicate the same result, i.e. the setup I had originally.

Am I missing something?

Thanks,

Phil

*** UPDATE 2021-01-21 *** In answer to some questions:

  1. To remove & re-install nginx I did the following;
sudo apt remove nginx
sudo apt install nginx

I also tried;

sudo apt purge nginx
sudo apt install nginx

*** UPDATE 2021-01-21 P2 ***

pi@raspberrypi:~ $ cat /etc/apt/sources.list
deb http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi
pi@raspberrypi:~ $ cat /etc/apt/sources.list.d/raspi.list
deb http://archive.raspberrypi.org/debian/ stretch main ui
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://archive.raspberrypi.org/debian/ stretch main ui
pi@raspberrypi:~ $

Looks like my RPi3B is running Stretch.


pi@raspberrypi:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
VERSION_CODENAME=stretch
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
pi@raspberrypi:~ $

Not sure if that is part of the problem.

The Pi is only running Pi-Hole for my home network, so I could backup my Pi-Hole config, do a clean install of the latest Pi OS image, install Pi-Hole and restore the config. It's a bit of a sledgehammer approach but should restore me to a nice clean setup ready to start again (and clear out some of the old dross that I had previously partially installed and never really used).

4
  • modules definitely live in /usr/lib/nginx - not sure what populates /var/lib/nginx but there's definitely stuff there too on my rpi – Jaromanda X Jan 20 at 2:25
  • What commands exactly do you used to remove and re-install nginx? Please edit the question and add it there. – Ingo Jan 20 at 23:22
  • It is a good idea to start over again with the up to date Raspberry Pi OS based on Buster. – Ingo Jan 21 at 18:29
  • Please don't answer your question in the question. Instead create an ordinary answer and mark it as the accepted one after two days with a click on the tick on its left side. That prevents your Question from being shown as an unsolved Post to the community and saves them/us a lot of work. – Ingo Jan 25 at 9:58
1

It's difficult to see what has gone wrong with your setup if you didn't try to manage it by hand. Check if you have the correct repositories addressed. By default they should look like this:

rpi ~$ cat /etc/apt/sources.list
deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi

rpi ~$ cat /etc/apt/sources.list.d/raspi.list
deb http://archive.raspberrypi.org/debian/ buster main
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://archive.raspberrypi.org/debian/ buster main

Then you can reinitialize the package list. How to do it, follow this guide: Raspberry Pi sudo apt-get update not working.

After a reboot then try to deinstall nginx again:

rpi ~$ sudo apt purge --autoremove nginx

Have attention to the given output. Most of it are only informational messages but there may also be warnings that directories couldn't be removed because they are not empty. Have a look at them when the deinstallation has finished. If you don't need them delete them, if you don't know if needed, move them to a save location.

Maybe there are still running daemons from nginx so it is not a bad idea to reboot. Then try to install again:

rpi ~$ sudo apt install nginx
0
1

*** UPDATE 2021-01-24 ***

I've re-built my RPi3B with the latest Buster OS version, installed Pi-Hole and followed the instructions to install/configure Nginx (https://docs.pi-hole.net/guides/webserver/nginx/) and DoH with Cloudflared (https://docs.pi-hole.net/guides/dns/cloudflared/). Nginx is installed where I was expecting to be and I've (eventually) got it working with Pi-Hole.

The next step is to try configuring a DoH relay (https://scotthelme.co.uk/running-my-own-doh-relay-and-getting-pihole/) so I can use it remotely from my phone.

Thanks for the help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.