- Install Privoxy Web Proxy Software on Raspberry Pi
- Configure Privoxy Web Proxy Software on Raspberry Pi
- Configure Firefox Browser to User Raspberry Pi as Proxy
This article will introduce several methods for setting up a proxy server on your Raspberry Pi.
Install Privoxy Web Proxy Software on Raspberry Pi
The Proxy servers are common tools for accessing Web services or serving them.
In this case, we focus on the forward proxies, which the clients can use to enhance security or limit the outgoing traffic from the gateway. Our proposed scenario is to set up Raspberry Pi as a proxy server and forward traffic from other clients to it.
This solution uses the Privoxy software, which provides filtering capabilities for ad-blocking and other advanced features. Note that Privoxy does not have cache functionality, so it must be provided with additional software.
Privoxy is usually available for download on Raspberry Pi OS default repositories. You can run the following command to install it or otherwise confirm if it’s already been installed on your Raspberry Pi device:
sudo apt install privoxy
Configure Privoxy Web Proxy Software on Raspberry Pi
At this point, if the installation was successful, Privoxy should be set up with default configuration and running on the
localhost:8118 port. Notice that this configuration is only sufficient to utilize filtering proxy capabilities on the same client machine.
However, if we provide the proxy server on Raspberry Pi to other client machines, then Privoxy should be listening on the external port. The latter needs to be configured by editing the
Privoxy config file needs to be edited using
sudo privileges, but you can use any text editor you’re most familiar with. In the following example commands, we will use
vim text editor:
sudo vim /etc/privoxy/config
Once the config file is open, search for a line that includes
Note that the Privoxy configuration file contains quite large comments, so it’s best to search for specific keywords. The above line should be changed as follows:
The Privoxy service that runs in the background should automatically take effect. You can also inspect external open ports using
nmap software described in another article.
If for some reason, the Privoxy is not listening on the external
8118 port, you can restart the service to force the config update using the following command:
sudo systemctl restart privoxy.service
Configure Firefox Browser to User Raspberry Pi as Proxy
Now, we move on to the client configuration, which can be done on any client machine you’d like to access the Web using proxy server setup on the Pi.
In this case, we only show the client setup on Firefox Browser, which allows us to use a proxy without setting a system-wide proxy. Enter
about:preferences in the address bar of Firefox and navigate to the
Network Settings section.
Then, click the Settings button to see the proxy configuration options. Choose manual proxy configuration and specify the Pi’s IP address in the
HTTP Proxy box. Specify the port number
8118 and mark the checkbox
Also use this proxy for HTTPS as well.
Next, access the web services using the proxy server on Raspberry Pi. To verify this, enter the following address in the address bar and press Enter:
It should display a webpage starting with the Privoxy version and hostname, IP address, and port number where it’s running.
If this step leads to a page that says that Privoxy is not being used, check if other services like the firewall may interfere. If so, allow the firewall running on the Pi to pass the traffic from the specific client IP addresses to the given service port.
You can check out our guide to
ufw to set up these rules.
- MySQL in Raspberry Pi
- Setup a Raspberry Pi File Server
- DNS Server on Raspberry Pi
- Dropbox on Raspberry Pi
- Plex Media Player on Raspberry Pi
- Chromium OS on Raspberry Pi