Install and configure Tinyproxy on Ubuntu 14.04
Tinyproxy is a HTTP proxy server daemon for POSIX operating systems. Designed to be fast and small, it is useful when an HTTP/HTTPS proxy is required, but the system resources for a larger proxy are unavailable. Because of this it has been put to uses such as a tether on the iPhone, and on the OpenWrt.
Tinyproxy is primarily designed to run on Unix-like systems. Released under the GNU General Public License, Tinyproxy is free software and has been developed for a number of years. It is currently being maintained on GitHub as a publicly accessible project. Ohloh analyses it to be a project with "mature, well-established codebase and increasing year-over-year development activity."
- Anonymous mode: Allows specification of individual HTTP headers that should be allowed through, and which should be blocked.
- HTTPS support: Tinyproxy allows forwarding of HTTPS connections without modifying traffic in any way.
- Remote monitoring: Tinyproxy can be monitored remotely to view logs and access details.
- Load average monitoring: Tinyproxy can be configured to refuse connections after the server load reaches a certain point.
- Access control: Tinyproxy can be configured to only allow connections from certain subnets or IP addresses.
- Secure: With some configuration, Tinyproxy can be made to run without any special privileges, thus minimizing the chance of system compromise. Furthermore, it was designed with an eye towards preventing buffer overflows.
- Small footprint: Tinyproxy requires very little in the way of system resources - the memory footprint tends to be around 2MB with glibc, and the CPU load increases linearly with the number of simultaneous connections (depending on the speed of the connection). Therefore, Tinyproxy can be run on a spare, older machine without any impact on performance.
- URL based filtering: Tinyproxy allows domain and URL-based black- and whitelisting.
- Transparent proxying: Tinyproxy supports being configured as a transparent proxy, so that a proxy can be used without requiring any client-side configuration.
- Proxy chaining: Tinyproxy can use an upstream proxy server for outbound connections, instead of direct connections to the target server, creating a so-called proxy chain.
It’s always recommended to update your package repository cache before installing new packages.
sudo apt-get update
Install and Configure Tinyproxy
Tinyproxy can be installed from the default Ubuntu repositories with:
sudo apt-get install tinyproxy
Once the installation is complete, open the Tinyproxy configuration file with your editor of choice:
sudo nano /etc/tinyproxy.conf
The default port number is set to 8888, but you can change it to whatever you like. In most cases, the default port number does not need to be changed. Please note that if you want to run your Tinyproxy server on a port lower than 1024 you will need to start Tinyproxy using root.
By default Tinyproxy will only accept connections from 127.0.0.1. Scroll down to the authorization controls section and add your local computer’s IP address to the allow list:
Allow 127.0.0.1 Allow your.local.ip.address
If you do not know your computer's IP address, open your web browser and navigate to http://ipinfo.io/ip. Copy and paste the IP address shown at this site into the Tinyproxy configuration file.
All other default settings should be fine.
Save the configuration and restart the service.
sudo /etc/init.d/tinyproxy restart
Setup a cron job
Setting up a daily cron job will prevent memory leaks.
Use the command crontab -e to edit the crontab file and add the following line:
0 2 * * * /etc/init.d/tinyproxy restart
That's it. You have successfully installed Tinyproxy on your Ubuntu 14.04.