To install squid on CentOS, use yum install command .
yum install squid
cd squid -*
Now enter the following commands in order to configure, compile and install squid
This by default, will install it in “/usr/local/squid”.
Type ./configure –help to view all available options.
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:
or if you want to define an IP to listen to instead of all IPs, replace YOUR_SERVER_IP byyour server IP:
By default all the http access are denied. The ACL rules must be modified to allow access only to trusted users or all users. This is important if you don’t want everyone to use yourproxy server and eventually consume resources.
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
Make sure that http_access deny all is the last statement, this is because the ACLs are checked from top to bottom. Users with IPs in the range of my_ranged_ips will be allowed to use the server, anyone else falls through to the “deny all” and gets a failure message.
Once the configurations are done, restart squid:
To stop squid
To start squid