- [Instructor] Let's install Squid
and block a website.
Type sudo apt-get install squid.
Press Enter.
Type Y.
And press Enter.
To specify which site to block,
we need to edit the configuration file.
Type cd /etc/squid/.
Press Enter.
Type ls and squid.conf is the configuration file.
Now type sudo nano
squid.conf.
Press Enter.
Press Control and W together to do a search.
Type url_regex.
Press Enter.
Let's add our rule here.
Type acl space
banned,
B-A-N-N-E-D, space,
url_regex.
Here regex stands for regular expression used
to specify search patterns.
Our search pattern is a portion of a URL.
We use the label banned
to name this rule.
We'll be using a file to store the banned URLs.
Therefore, we need to specify where the file is.
Type a double quotation mark.
/etc/squid/
and then the name of the file, blocked.
And close the double quotation mark.
Now find a line that says insert your own rules.
And add http_access deny
space banned.
Let's save the file by pressing Control and X together.
Type Y.
Press Enter.
Next, let's create our file
that contains the list of blocked sites.
Type sudo
nano space
the name of the file, blocked.
Press Enter.
Type .microsoft.com.
Based on this regular expression,
our proxy server Squid will block
whatever domain name ending with .microsoft.com.
Let's save the file.
Press Control and X together.
Type Y.
Press Enter.
Now let's restart Squid
to use the updated configuration file.
Type sudo systemctl
restart
squid.
Press Enter.
If you didn't have any typos in the configuration file,
this will go without any errors.
Yes, success.
Now, open a web browser, click on the gear icon,
type proxy in the search field.
Click on Settings.
Choose manual proxy configuration.
Our proxy server is the localhost.
The port number we're using here
is the default port number for the proxy servers,
which is 3128.
Click on OK.
Let's try to visit World Wide Web .microsoft.com
and see what happens.
As you can see, our access attempt
is being blocked by the proxy server.