Squid proxy server on Linux

 

Introduction

Two important goals of many small businesses are to:

* Reduce Internet bandwidth charges.

* Limit access to the Web to only authorized users.

The Squid web caching proxy server can achieve both these goals fairly easily.

Users configure their web browsers to use the Squid proxy server instead of going to the web directly. The Squid server then checks its web cache for the web information requested by the user. It will return any matching information that finds in its cache, and if not, it will go to the web to find it on behalf of the user. Once it finds the information, it will populate its cache with it and also forward it to the user's web browser.

As you can see, this reduces the amount of data accessed from the web. Another advantage is that you can configure your firewall to only accept HTTP web traffic from the Squid server and no one else. Squid can then be configured to request usernames and passwords for each user that users its services. This provides simple access control to the Internet.

Essential information

The squid configuration file location varies but is often /etc/squid/squid.conf

Find the file squid.conf.orig, which is probably in the same directory as squid.conf.

This file will have all the options available, a description of what they are for and their default setting.

For troubleshooting purposes read the access.log. The location of this log can be found in the squid.conf file with an entry similar to the following

cache_access_log /var/log/squid/access.log

Squid will resolve domain names using DNS or the hosts file depending on the settings in /etc/nsswitch.conf, so check name resolution of both.

To start, stop and restart squid use the following commands.

service squid start

service squid stop

service squid restart