Turning your server into a proxy using Squid
Installing Squid
To install squid on CentOS, use yum install command (you must be logged in as root (If you’re not familiar with yum and root access, you might want to check the following topic first: 15 most used linux commands and how to use them)):
cd squid -*
Now enter the following commands in order to configure, compile and install squid
make
make install
This by default, will install it in “/usr/local/squid”.
Type ./configure –help to view all available options.
Configuring Squid
In order to configure squid, we open the squid configuration file located in /etc/squid
By default, squid will listen on port 3128, to make it listen on port 3128, 8080 and port 2083, we add the following:
http_port 2083
http_port 8080
or if you want to define an IP to listen to instead of all IPs, replace YOUR_SERVER_IP by your server IP:
http_port YOUR_SERVER_IP:2083
http_port YOUR_SERVER_IP:8080
To allow everyone to access and use the proxy server, append the following line to the configuration file:
(make sure to remove the line http_access deny all for the above to work)
To allow a range of IPs instead of allowing everyone, add the following command
http_access allow my_ranged_ips
http_access deny all
Once the configurations are done, restart squid:
To stop squid
To start squid
Any comments, questions or suggestions? Post below!