Squid is a popular, free Linux program that allows you to create a forwarding web proxy. In this guide, you'll see how to install Squid on CentOS to turn your server into a web proxy.
Squid can be configured as a reverse proxy as well, but that type of setup is not covered in this article.
This guide was written for CentOS 6, but should also work for CentOS 7.
I'm going to assume that you have a new CentOS server. You can now install Squid with
yum install squid
You can now configure Squid. The configuration file is located at the following path:
Open this file with your favorite text editor in order to configure Squid settings. You can find an overview of them on the official Squid website.
Now open the Squid port in the firewall. The default port is
3128. If you changed it, naturally, open the port you set Squid to run on:
iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 3128 -j ACCEPT
You can now restart the Squid service:
service squid restart
To make Squid start every time you start your server, use
chkconfig squid on
In order to see your users' activity, you can use the
tail command to read the logs:
tail -f /var/log/squid/access.log
You can now configure other computers to send their traffic through your Squid proxy. If you would like to do this on OS X, Windows, or Linux, follow this guide.