Squid Proxy Ubuntu 16_04


How to Setup Squid Proxy Server on Ubuntu 18.04 & 16.04

How to Setup Squid Proxy Server on Ubuntu 18.04 & 16.04

Squid is the most popular Proxy server for Unix like operating systems. It also used for the web filtering. Squid also useful as caching proxy server for the HTTP, HTTPS, FTP article will help you to setup Squid Proxy Server on Ubuntu 18. 10, 18. 04 LTS, 16. 04 LTS, and 14. 04 LTS 1 – Install PackageSquid packages are available in default yum repositories. Execute below command on your server to install SQUID proxy apt update
sudo apt install squid
Step 2 – Configure Squid PortThe default port for the Squid proxy servers is 3128. You can change this as per the requirements. To setup Squid on different port, Edit squid configuration file and change _port value with new port. /etc/squid/ _port 3128
After making changing let’s restart Squid service to reload the configuration changessudo service squid restart
The next steps will help you to Setup Squid Proxy Server on Ubuntu systems. Use only those settings, which is required for your proxy 3 – Allow All TrafficSometimes you are required to allow all traffic on your proxy server. In Squid server open Squid configuration file. Comment the _access deny all line and add the _access allow all entry this file. /etc/squid/ _access allow all
#_access deny all
Step 4 – Block Specific Website with SquidLet’s start with the additional configuration like blocking any website using squid proxy server. Add below rules to block specific website before any allow all rules. Below example will block and blocksite1 dstdomain
acl blocksite2 dstdomain _access deny blocksite1
_access deny blocksite2
If you have a long list of domain names, Create a file /etc/squid/ and put domain names one per line and add below rule in the squid configuration file. /etc/squid/nfacl blocksitelist dstdomain “/etc/squid/”
_access deny blocksitelist
file content example:cat /etc/squid/
Step 5 – Block Specific Keyword with SquidAdd below rules to block specific website before any allow all rules. Below example will block all pages having keyword yahoo or Gmail. /etc/squid/nfacl blockkeyword1 url_regex yahoo
acl blockkeyword2 url_regex gmail
_access deny blockkeyword1
_access deny blockkeyword2
If you have a long list of keywords, Create a file /etc/squid/ and put keywords one per line and add below rule in the squid configuration file. /etc/squid/nfacl blockkeywordlist url_regex “/etc/squid/”
_access deny blockkeywordlist
Congratulation’s you have successfully install and configured Squid proxy server. Read next article to Configure Squid for Mac Address Based Filtering.
Squid Proxy Server Installation and Configuration | Liquid Web

Squid Proxy Server Installation and Configuration | Liquid Web

A Squid Proxy Server is a feature-rich web server application that provides both reverse proxy services and caching options for websites. This provides a noticeable speedup of sites and allows for reduced load times when being reverse proxy is a service that sits between the Internet and the webserver (usually within a private network) that redirects inbound client requests to a server where data is stored for easier retrieval. If the caching server (proxy) does not have the cached data, it then forwards the request on to the web server where the data is actually stored. This type of caching allows for the collection of data and reproducing the original data values stored in a different location to provide for easier access. A reverse proxy typically provides an additional layer of control to smooth the flow of inbound network traffic between your clients and the can be used as a caching service to SSL requests as well as DNS lookups. It can also provide a wide variety of support to multiple other types of caching protocols, such as ICP, HTCP, CARP, as well as WCCP. Squid is an excellent choice for many types of setups as it provides very granular controls by offering numerous system tools, as well as a monitoring framework using SNMP to provide a solid base for your caching selecting a computer system for use as a dedicated Squid caching proxy server, many users ensure it is configured with a large amount of physical memory (RAM) as Squid maintains an in-memory cache for increased stalling SquidLet’s start by ensuring our server is up to date:[[email protected] ~]# apt-get update
Get:1 xenial-security InRelease [109 kB]Hit:2 xenial InReleaseHit:3 xenial InReleaseGet:4 xenial-updates InRelease [109 kB]Get:5 xenial-backports InRelease [107 kB]Fetched 325 kB in 0s (567 kB/s)Reading package lists… Done
Next, at the terminal prompt, enter the following command to install the Squid server:
[[email protected] ~]# apt install squid
Reading package lists… DoneBuilding dependency treeReading state information… DoneThe following packages were automatically installed and are no longer required:linux-headers-4. 4. 0-141 linux-headers-4. 0-141-generic linux-image-4. 0-141-genericUse ‘apt autoremove’ to remove them.
The following additional packages will be installed:
libecap3 squid-common squid-langpack ssl-cert
Suggested packages:
squidclient squid-cgi squid-purge smbclient ufw winbindd openssl-blacklist
The following NEW packages will be installed:
libecap3 squid squid-common squid-langpack ssl-cert
0 upgraded, 5 newly installed, 0 to remove and 64 not upgraded.
Need to get 2, 672 kB of archives.
After this operation, 10. 9 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Fetched 2, 672 kB in 0s (6, 004 kB/s)
Preconfiguring packages…
Selecting previously unselected package libecap3:amd64.
(Reading database… 160684 files and directories currently installed. )
Preparing to unpack… /…
Unpacking libecap3:amd64 (1. 0. 1-3ubuntu3)…
Selecting previously unselected package squid-langpack.
Unpacking squid-langpack (20150704-1)…
Selecting previously unselected package squid-common.
Unpacking squid-common (3. 5. 12-1ubuntu7. 6)…
Selecting previously unselected package ssl-cert.
Unpacking ssl-cert (1. 37)…
Selecting previously unselected package squid.
Unpacking squid (3. 6)…
Processing triggers for libc-bin (2. 23-0ubuntu10)…
Processing triggers for systemd (229-4ubuntu21. 16)…
Processing triggers for ureadahead (0. 100. 0-19)…
Setting up libecap3:amd64 (1. 1-3ubuntu3)…
Setting up squid-langpack (20150704-1)…
Setting up squid-common (3. 6)…
Setting up ssl-cert (1. 37)…
Setting up squid (3. 6)…
Skipping profile in /etc/apparmor. d/disable:
Processing triggers for ureadahead (0. 0-19).. ’s it! The installation is complete! Configuring SquidThe default Squid configuration file is located in the ‘/etc/squid/ directory, and the main configuration file is called “”. This file contains the bulk of the configuration directives that can be modified to change the behavior of Squid. The lines that begin with a “#”, are commented out or not read by the file. These comments are provided to explain what the related configuration settings edit the configuration file, let’s start by taking a backup of the original file, in case we need to revert any changes if something goes wrong or use it to compare the new file configurations. [[email protected] ~]# cp /etc/squid/ /etc/squid/ Squid’s Default Listening PortNext, the Squid proxy servers default port is 3128. You can change or modify this setting to suit your needs should you wish to modify the port for a specific reason or necessity. To change the default Squid port, we will need to edit the Squid configuration file and change the “_port” value (on line 1599) to a new port number. [[email protected] ~]# vim /etc/squid/
_port 2946(Keep the file open for now…)Change Squid’s Default HTTP Access PortNext, to allow external access to the HTTP proxy server from all IP addresses, we need to edit the “_access” directives. By default, the HTTP proxy server will not allow access to anyone at all unless we explicitly allow it! Caution! : Multiple settings mention _access. We want to modify the last entry. 1164 # Deny requests to certain unsafe ports
1165 _access deny! Safe_ports…
1167 # Deny CONNECT to other than secure SSL ports
1168 _access deny CONNECT! SSL_ports…
1170 # Only allow cachemgr access from localhost
1171 _access allow localhost manager
1172 _access deny manager…
1186 #_access allow localnet
1187 _access allow localhost…
1189 # And finally deny all other access to this proxy
1190 _access deny all
# > change to “allow all”

How To Install And Configure Squid Proxy On Ubuntu And …

About Squid Proxy
Squid Proxy is a a great proxy server mainly used for caching frequently requested web content in order to speed up response time and also save network bandwidth. It supports many different protocols such as HTTP, FTP, TLS, SSL, Internet Gopher and HTTPS. Although it was originally designed to run as a daemon on Unix-like systems there have been several ports to windows, but according to wikipedia more current versions are not being developed.
Squid Proxy is released under the GNU General Public License.
In this tutorial you will learn how to install and setup Squid Proxy on Ubuntu and Debian Linux distributions. Just follow each step of this guide carefully and everything will be ok.
How To Install Squid Proxy
There are many ways to install Squid Proxy on Ubunu and Debian systems, one of them is to use the command apt-get install since there is a package of this proxy available in the default repo. First open a new terminal emulator (CTRL+ALT+T) and update the package index like shown below.
sudo apt-get update
Once the update is finished installing Squid Proxy server on Ubuntu and Debian computers is very easy. All you have to do is run the following command.
sudo apt-get install squid
Then you will be asked if you want to continue with the installation. Type Y.
Wait for the download and installation to finish.
Squid Configuration
Before playing with this proxy there is something we need to do. Open the configuration file of Squid Proxy which is located under the directory /etc.
Depending on the version installed on your system you have to look for a specific path. Try to look for /etc/squid3/ or /etc/squid/ Once you know where your configuration file is located then use your favorite text editor to edit it.
I use vim for text editing.
vim /etc/squid3/
Once you have opened the file you will see something similar to the following.
Look for _access. Nobody can access the Squid Proxy server by default as _access is set to deny all.
The line will look like shown below.
_access deny all
In order to start using the Squid Proxy change _access to allow.
_access allow
Save the file but do not close it yet. We need to setup a hostname for our proxy server. You can use any name you like as Squid Proxy server allows to do that. The default one is localhost.
Find visible_hostname and give the name you want.
Now use the following command to restart the Squid Proxy.
sudo service squid3 restart
If the above command does not work for you just try the other one shown below.
sudo service squid restart
I get the following output.
[email protected]:~/Desktop$ sudo service squid3 restart
squid3 stop/waiting
squid3 start/running, process 4025
It is time to test if our proxy server is working or not. Go to your web browser’s settings and configure it to use a proxy server. I use Mozilla Firefox so I am going to show you how to do it for this browser. In case you are using Google Chrome or another web browser just google on how to configure your browser to use a proxy server.
Client Side Configuration
For Firefox:
Go to Preferences -> Advanced -> Network and click on Settings under Connection. And click on Manual Proxy Configuration like shown below.
Inside HTTP Proxy pus the ip address of the Squid server and port 3128 which is the default port being used by Squid Proxy. You can also change the default port by editing it in
Click on Ok and the proxy should work.
Enjoy it!

Frequently Asked Questions about squid proxy ubuntu 16_04

About the author


If you 're a SEO / IM geek like us then you'll love our updates and our website. Follow us for the latest news in the world of web automation tools & proxy servers!

By proxyreview

Recent Posts

Useful Tools