Documentation menu

How to install the SQUID proxy server

The quickest way to run a proxy server is with Docker:

Bash
          docker run --name squid -p 3128:3128 --rm -d \
-e PROXYLOGIN=mylogin \
-e PROXYPASSWORD=mypassword \
anticaptcha/squid
        

If you wish to set your own configuration file, where you'd set up authentication, then mount it to /etc/squid/squid.conf

Bash
          docker run --name squid -p 3128:3128 --rm -d \
-v /path/to/squid.conf:/etc/squid/squid.conf \
anticaptcha/squid
        


Another way is to build from source:

Bash
          yum -y install make gcc gcc-c++ libtool wget httpd-tools
wget http://www.squid-cache.org/Versions/v3/3.2/squid-3.2.3.tar.gz
tar -zxf squid-3.2.3.tar.gz
cd squid-3.2.3
./configure
make
make install
        

Example of configuration file:

Bash
          #configure the port number
http_port 9191

cache_mem 5 MB
cache_dir ufs /usr/local/squid/var/cache 300 16 256
cache_access_log /usr/local/squid/var/logs/access.log
cache_log /usr/local/squid/var/logs/cache.log
cache_store_log /usr/local/squid/var/logs/store.log
pid_filename /usr/local/squid/var/logs/squid.pid



auth_param basic program /usr/local/squid/libexec/basic_ncsa_auth /usr/local/squid/etc/squid_users

auth_param basic children 5
auth_param basic realm enter_your_pass
auth_param basic credentialsttl 2 hours

error_directory /usr/local/squid/share/errors/


acl SSL_ports port 443
acl Safe_ports port 80 8080 3128 # http
acl Safe_ports port 443# https
acl CONNECT method CONNECT
acl MYUSERS proxy_auth REQUIRED
acl to_ipv6 dst ipv6


http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow net


#allow only athorized users
http_access allow MYUSERS
http_reply_access allow all
icp_access deny all
miss_access allow all


#squid will run under nobody user
cache_effective_user nobody
cache_effective_group nobody
coredump_dir /usr/local/squid/var/cache


## making it anonymous
forwarded_for transparent
request_header_access Via deny all
request_header_access X-Forwarded-For deny all
request_header_access Cache-Control deny all
        

SQUID keeps logins and passwords in a separate file, in our case, it's "/usr/local/squid/etc/squid_users". To manage this file, use "htpasswd" tool:

Bash
          htpasswd -c /usr/local/squid/etc/squid_users mylogin
        

After you've done with configuration, change permissions of SQUID's directories and run it as a daemon:

Bash
          chown -R nobody:nobody /usr/local/squid/share /usr/local/squid/var
/usr/local/squid/sbin/squid -z /usr/local/squid/etc/squid.conf
/usr/local/squid/sbin/squid -f /usr/local/squid/etc/squid.conf
        

Check that the proxy is running and accepting connections:

Bash
          netstat -lenp|grep squid