So I have a raspberry pi 3 B+ and what I am trying to do is set up more than one web server on my pi, in this case, pihole and nextcloud, everything else I add works without any conflicts.
From what I have read I need something like a reverse proxy? Does anyone have any experience with this? Or are there any alternatives to achieve the same thing.
I did have a go with NGINX reverse proxy, but I just could not get it to work. Mainly I think it is to do with having lighttpd for pihole, apache2 for nexcloud and Nginx as the reverse proxy. Only one of them would run in one instance because they all use port 80, So if I run Nginx the other services would stop.
Why not just add a second ip address to your pi’s interface and have nextcloud listen on port 80 on one address for pihole and port 80 on the other address for nextcloud?
I did try docker, it was pretty difficult to find the right configuration for next cloud and the tweaks that I could make to have both systems run together simultaneously.
Why? because it does load balancing as well. And one day you’ll need to do load balancing at work. And… for doing load balancing, haproxy is way more advanced.
If you are using lighttpd for pihole and apache for nextcloud, you may be able to add a second address to your pi’s interface and make two simple edits to the default configs to listen on specific addresses:
add an address: ip address add 10.0.0.151 dev eth0 (I just piecked 10.0.0.151 and eth0 as examples. Use whatever you want for the ip in your subnet. It’s a good idea to pick something out of your dhcp server’s dynamic range so you don’t run into a conflict.)
edit lighttpd config (probably /etc/lighttpd/lighttpd.conf) to include server.bind = (address1)
edit your nextcloud apache config (maybe /etc/apache2/sites-available/nextcloud) to include listen (address2)
edit: After your edits, you would need to restart each service. systemctl restart lighttpd httpd would probably work.
I finally got it to work, although it is a little temperamental. but I think there are some tweaks to be made.
I have not got it setup the same way as you (separate ip addresses per web server instance) but I have it setup with the same ip, just different ports for different services.
But I will be sharing them here in a form of a template as my contribution to the community. if anyone is looking to do the same think.