Wednesday, January 11, 2017

Running pihole on your raspberry pi if you already have an Apache server running

Yes, this could have been titled "How to change your apache server port"..but this was my specific reasoning for needing to change it.  Get over it!

So if you're like me and the countless others...pihole sounds pretty enticing.  If you're not familiar with it, a 2 second blurb would be this: It's a nifty "black hole for internet advertisements."  You basically configure your home DNS to point towards your Raspberry Pi, that points to a DNS provider of your choosing with the Pi in the middle blocking known advertisement domains.

Well, I'm running an apache server at my house on port 80.  Pi hole uses lighttpd and is managed by navigating to your Pi's ip address/admin.  In an effort to keep my apache server AND run Pi hole..I'll need to change the TCP ports that one of the servers is listening on.

Sorry Apache!


Under the apache2 directory you'll see a .conf file called "ports.conf" and an additional directory called "sites-enabled."

One can easily read the output of "ports.conf" by using the command "more ports.conf" from the apache2 directory.


We're going to want to change the 80 values to something different.  I've decided to go with 8080, for example.  To modify the "ports.conf" file, use the "sudo nano ports.conf" command.  Once you've made your changes press "ctrl-x," save your configs, and accept the file name.

Next, lets go into the directory called "sites-enabled."


I simply have the default, "000-default."


We're going to want to modify the virtual host value from 80 to 8080 here as well.

Once we've made these changes, restart apache: "sudo service apache2 restart"

Next, lets go ahead and restart the lighttpd service as well: "sudo service lighttpd restart"




Awesome!

3 comments: