Installing and Configure Squid Proxy Server
Here are the simple steps to install squid –
Login as root and execute,
cd /usr/local/src
wget http://www.squid-cache.org/Versions/v2/2.5/squid-2.5.STABLE14.tar.gz
tar -zxvf squid-2.5.STABLE14.tar.gz
cd squid-2.5.STABLE14
./configure –prefix=/usr/local/squid –disable-ident-lookups
make all
make install
Add the user squid, create the cache directory and then set permissions.
useradd -d /usr/local/squid/cache/ -r -s /dev/null squid >/dev/null 2>&1
mkdir /usr/local/squid/cache
chown -R squid:squid /usr/local/squid/cache
chown -R squid:squid /usr/local/squid
chmod -R 755 /usr/local/squid/cache
Now generate the cache files
sudo -u squid /usr/local/squid/sbin/squid -z
Now lets change the cache effective user and group to squid.
perl -pi -e ’s/# cache_effective_user nobody/cache_effective_user squid\ncache_effective_group squid/g’ /usr/local/squid/etc/squid.conf
/usr/local/squid/sbin/squid
You are done installing …
Configuration
Open the squid configuration,
pico /usr/local/squid/etc/squid.conf
specific your http_port, by default this is 3128, we will use 8080.
Find
# http_port 3128
and replace it with
http_port 8080
Now lets configure who can access your proxy, remember to only allow access to YOUR ip.
Find
http_access deny CONNECT !SSL_ports
Add below
acl myip 127.0.0.1
acl all src 0.0.0.0/0.0.0.0
acl connectmethod method CONNECT
http_access deny connectmethod
http_access deny all
http_access allow myip
Remember to replace 127.0.0.1 with the ip you want to allow access.
Find
# By default, all headers are allowed (no anonymizing is
# performed).
#
#Default:
# none
Add below
header_access From deny all
header_access Referer deny all
header_access Server deny all
header_access User-Agent deny all
header_access WWW-Authenticate deny all
header_access Link deny all
header_access via deny all
Find
# forwarded_for on
Replace with
forwarded_for off
Save and exit squid.conf, then restart squid.
kill -9 $(ps aux | grep squid | awk ‘{print $2}’)
/usr/local/squid/sbin/squid
You have now configured an anoymous proxy with squid.
Thanks to HOstgeekz ![]()









