Ubuntu

Setup Squid Proxy Server on Ubuntu 18.04/16.04

Setup Squid Proxy Server on Ubuntu 18.04 & 16.04

Insight: Setup Squid Proxy Server on Ubuntu 18.04/16.04

There are number of proxy server available in the Internet.  Squid is one of the most popular Proxy server for Linux. It can be used for multiple purpose like caching, web filtering and else. In this tutorial, we are going to show you the method to setup Proxy server on Ubuntu 18.04 LTS and Ubuntu 16.04 LTS.

This article will help you to setup Squid Proxy Server on Ubuntu 18.10, 18.04 LTS, 16.04 LTS, and 14.04 LTS systems.

Setup Squid Proxy Server on Ubuntu 18.04/16.04

Run the following command to update your system and install Squid on Ubuntu.

sudo apt update
sudo apt install squid

After installing Squid proxy servers, you can configure squid port. Default port for the Squid proxy servers is 3128. If you want to change the port then edit squid configuration file (/etc/squid/squid.conf) and change the port:

 http_port 3128

Now, Restart the squid proxy server.

sudo service squid restart

Now, let’s configure the traffic through Proxy server.

To allow all traffic on your proxy server.

Open Squid configuration file and configure it.

 http_access allow all
 #http_access deny all

To Block Specific Website with Squid

Open squid configuration file and configure it to block specific website. We are blocking facebook.com and bing.com in the example below.
<pre”>acl blocksite1 dstdomain bing.com acl blocksite2 dstdomain www.facebook.com http_access deny blocksite1 http_access deny blocksite2

Squid have another feature too as you can block a large number of website by creating a list file. You need  to create a file /etc/squid/websiteblockers.lst and list your domain names to get blocked.

acl blocksitelist dstdomain "/etc/squid/websiteblockers.lst"
http_access deny blocksitelist

Below is the short example of website list which you want to get blocked.

cat /etc/squid/websiteblockers.lst

domain.com
godaddy.com
twitter.com
www.facebook.com

To Block Specific Keyword with Squid

You can also block specific keyword with squid.

acl blockkeyword1 url_regex media
acl blockkeyword2 url_regex chat
http_access deny blockkeyword1
http_access deny blockkeyword2

Same like domain, you can also block the list of keywords by creating a file. You can create a file  /etc/squid/yourfileofkeywords.lst and put keywords one per line

acl blockkeywordlist url_regex "/etc/squid/yourfileofkeywords.lst"
http_access deny blockkeywordlist

yourfileofkeywords.lst file content example:

cat /etc/squid/yourfileofkeywords.lst

media
myspace
twitch
howtoearnonline

 

READ THIS ALSO  Install JDK 10 In Ubuntu Or Linux Mint From PPA Repository

This much for now. Let us know if there is any error in this post.



Subscribe To Our Newsletter.

Join our mailing list to receive the latest linux tutorials, tips & tricks, freebies,news and updates from our team.

You have Successfully Subscribed!