What's new

Welcome to GloTorrents Community

Join us now to get access to all our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, and so, so much more. It's also quick and totally free, so what are you waiting for?

Ask question

Ask Questions and Get Answers from Our Community

Answer

Answer Questions and Become an Expert on Your Topic

Contact Staff

Our Experts are Ready to Answer your Questions

How to Setup Squid Proxy Server on Ubuntu 18.04 & 16.04

_.:=iTake=:._

Administrator
Staff member
ZeuS
Super Moderator
+Lifetime VIP+
Registered
Joined
Oct 20, 2018
Messages
1,370
Reaction score
1,431
Points
113
Credits
14,854
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 protocols.

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.

Step 1 – Install Package
Squid packages are available in default yum repositories. Execute below command on your server to install SQUID proxy server.

Code:
sudo apt update
sudo apt install squid

or

Code:
sudo apt install squid3

Step 2 – Configure Squid Port
The 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 http_port value with new port.

Code:
/etc/squid/squid.conf
http_port 3128

After making changing let’s restart Squid service to reload the configuration changes

Code:
sudo 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 server.

Step 3 – Allow All Traffic
Sometimes you are required to allow all traffic on your proxy server. In Squid server open Squid configuration file. Comment the http_access deny all line and add the http_access allow all entry this file.

Code:
/etc/squid/squid.conf
http_access allow all
#http_access deny all



Step 4 – Block Specific Website with Squid
Let’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 yahoo.com and www.rediff.com.

Code:
/etc/squid/squid.conf
acl blocksite1 dstdomain yahoo.com
acl blocksite2 dstdomain www.rediff.com
http_access deny blocksite1
http_access deny blocksite2

If you have a long list of domain names, Create a file /etc/squid/blockwebsites.lst and put domain names one per line and add below rule in the squid configuration file.

Code:
/etc/squid/squid.conf
acl blocksitelist dstdomain "/etc/squid/blockwebsites.lst"
http_access deny blocksitelist

[B]blockwebsites.lst[/B] file content example:

cat /etc/squid/blockwebsites.lst

yahoo.com
www.rediff.com

Step 5 – Block Specific Keyword with Squid
Add below rules to block specific website before any allow all rules. Below example will block all pages having keyword yahoo or Gmail.

Code:
/etc/squid/squid.conf
acl blockkeyword1 url_regex yahoo
acl blockkeyword2 url_regex gmail
http_access deny blockkeyword1
http_access deny blockkeyword2
If you have a long list of keywords, Create a file /etc/squid/blockkeywords.lst and put keywords one per line and add below rule in the squid configuration file.

Code:
/etc/squid/squid.conf
acl blockkeywordlist url_regex "/etc/squid/blockkeywords.lst"
http_access deny blockkeywordlist

blockkeywords.lst file content example:

cat /etc/squid/blockkeywords.lst

yahoo
gmail
facebook

Congratulation’s you have successfully install and configured Squid proxy server.

Credits to tecadmin.net
 
Last edited:
shape1
shape2
shape3
shape4
shape7
shape8
Top