How To Install and Configure Squid Web Proxy Server On Linux? – POFTUT

How To Install and Configure Squid Web Proxy Server On Linux?


Corporate generally uses web proxies in order to speed up and secure internet web traffic. There are a lot of paid or open source web proxy applications. Squid is most popular web proxy used by a lot of users. In this tutorial we will look how to install and configure squid proxy.

Advantages Of Squid Web Proxy

  • Share internet connection
  • Speed up internet web surfing
  • Control internet web surfing
  • Secure against web related attacks

Install Squid For Ubuntu, Debian, Mint

Squid is very popular in the open source community. This makes it available for most of the Linux distributions as packages. We can use following command in order to install it into Ubuntu, Debian, Mint or related distributions.

$ sudo apt install squid
Install Squid For Ubuntu, Debian, Mint
Install Squid For Ubuntu, Debian, Mint

Install Squid For Fedora, CentOS, RHEL

We can also install squid packages in Fedora, CentOS and RHEL distributions. We can use both dnf or yum package managers.

$ sudo yum install squid

Configuration File squid.conf

Squid provides a lot of configuration. All of these configuration is stored in squid.conf file which is located in /etc/squid . While extending default configuration we can divide the configuration into multiple files too by referencing them from main configuration file.

Configuration File squid.conf
Configuration File squid.conf

Change Default Proxy Port 3128

Proxies are used by connecting proxy port and redirecting web traffic. Squid listens TCP 3128 port by default but changing it to 8080 will be more meaningful most of the situations. But 8080 must be not used other applications.

Find following line

http_port 3128

and change with the following line

http_port 8080

Add Rules

Adding rules are easy as writing some text. We will add some Access Control List or acl . ACL is used to add rules to the specific IP address or network range. In this example we will give access to the squid proxy for the network 192.168.1.0

First we define network range with acl

acl home src 192.168.1.0/24

and then we give access to this acl named home

http_access allow home

Restart Squid Service To Apply New Rules

In order to make configuration changes active we should reload the configuration. This means we should restart squid service which will reread the new configuration. We can use systemctl command for most of the Linux distributions.

$ sudo systemctl restart squid

LEARN MORE  Introduction To Squid Proxy Tutorial with Examples

Leave a Comment