Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. Squid proxy is used by various organisation and internet providers to reduce bandwidth and to increase response time. In this tutorial we will show you how to install and configuration of Squid on your Ubuntu server.
This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple. I will show you through the step by step installation Squid on Ubuntu server.
Install and Configure Squid 3 on Ubuntu
Step 1. To install, first you must update yum repository and packages by typing the below command:
apt-get -y update
Step 2. Installing Squid proxy server.
Install squid package and dependencies using the below command:
apt-get -y install squid3
Step 3. Edit squid configuration file ‘/etc/squid/squid.conf’
nano /etc/squid3/squid.conf
# Recommended minimum configuration: auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid3/squid_passwd acl ncsa_users proxy_auth REQUIRED http_access allow ncsa_users acl manager proto cache_object acl localhost src 127.0.0.1/32 acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 acl SSL_ports port 443 acl Safe_ports port 80 # http acl Safe_ports port 21 # ftp acl Safe_ports port 443 # https acl Safe_ports port 1025-65535 # unregistered ports acl Safe_ports port 280 # http-mgmt acl Safe_ports port 488 # gss-http acl Safe_ports port 591 # filemaker acl Safe_ports port 777 # multiling http acl SSL_ports port 9001 # webmin acl CONNECT method CONNECT http_access allow manager localhost http_access deny manager http_access deny !Safe_ports http_access deny CONNECT !SSL_ports http_access deny all http_port 3128 #Setting up multiple outgoing IP addresses #acl godet myip 192.168.1.100 #tcp_outgoing_address 192.168.1.100 godet #acl jaran myip 192.168.1.101 #tcp_outgoing_address 192.168.1.101 jaran hierarchy_stoplist cgi-bin ? coredump_dir /var/spool/squid3 cache deny all refresh_pattern ^ftp: 1440 20% 10080 refresh_pattern ^gopher: 1440 0% 1440 refresh_pattern -i (/cgi-bin/|\?) 0 0% 0 refresh_pattern . 0 20% 4320 icp_port 3130 forwarded_for off request_header_access Allow allow all request_header_access Authorization allow all request_header_access Proxy-Authorization allow all request_header_access Proxy-Authenticate allow all request_header_access Cache-Control allow all request_header_access Content-Encoding allow all request_header_access Content-Length allow all request_header_access Content-Type allow all request_header_access Date allow all request_header_access Expires allow all request_header_access Host allow all request_header_access If-Modified-Since allow all request_header_access Last-Modified allow all request_header_access Location allow all request_header_access Pragma allow all request_header_access Accept allow all request_header_access Accept-Charset allow all request_header_access Accept-Encoding allow all request_header_access Accept-Language allow all request_header_access Content-Language allow all request_header_access Mime-Version allow all request_header_access Retry-After allow all request_header_access Title allow all request_header_access Connection allow all request_header_access Proxy-Connection allow all request_header_access User-Agent allow all request_header_access Cookie allow all request_header_access All deny all visible_hostname wpcademy.com
Step 4. Create our authentication file which Squid can use to verify for user authentications:
#htpasswd -b /etc/squid3/squid_passwd username password
Example:
htpasswd -b -c /etc/squid3/squid_passwd ranty ratna
Step 5. After making changes to the config file, save the file and restart the squid server service to effect the changes using the following command entered at a terminal prompt:
service squid3 restart
If you experience any problems, you can check the access.log for more information:
sudo tail -f /var/log/squid3/access.log
So you have successfully installed Squid . Thanks for using this tutorial for installing Squid caching proxy in Ubuntu system. For additional help or useful information, we recommend you to check the official Squid web site.