Install and Configure Squid Proxy Server

Proxy server is an application or a computer system that acts as an agent or channel for requests from clients looking for resources from other servers. Client connects to the proxy server with a service (web, files or any other resources) and proxy server sends that request to the server on behalf of the client. There are many software and applications available on the internet which can be used to setup a proxy server. The image below illustrates this process:


Squid is one of the well known open source proxy server which comes with Linux Operating system. In this post we will discuss:

1) Installation of Squid
2) Configure Port
3) Setting up ACL

1) Installation of Squid

You can download Squid source code from their official website and compile it or you can use YUM which is the easiest way of installation. Execute the following command to install Squid:

[root@centos ~]# yum install squid -y

2) Configure Port

By default Squid runs on port number 3128 but if you want to increase security, changing the port is recommended. To change the port you will have to edit Squid configuration file; open /etc/conf/squid.conf file in the editor.

[root@centos ~]# vi /etc/squid/squid.conf

Now search for “http_port” which will be commented; un-comment it and change the port number to which you want to set.

From

# Squid normally listens to port 3128
# http_port 3128

To

# Squid normally listens to port 3128
http_port 2882

Restart Squid server using command “server squid restart

Here we want the proxy to run on port no. 2882.  Also make sure to open this port in your server firewall settings.

3) Setting up ACL
ACL or Access Control List will be helpful to restrict the usage of proxy to your organization only i.e. proxy server can be used inside your organization premises. To setup ACL you will again have to edit the squid configuration file and search for “acl all src 0.0.0.0/0.0.0.0” and add

acl <acl name> src <IP address>
e.g.
acl testsquid src 192.168.0.2

Then search “http_access” and allow access to above mentioned ACL.

http_access allow testsquid

Restart Squid server using command “server squid restart

This entry was posted in Proxy server and tagged , , , . Bookmark the permalink.

Leave a Reply