Wednesday, September 3, 2014

Squid Proxy : Squid proxy server to block websites listed in file

Squid proxy server to block websites listed in file


In this tutorial we will use Squid proxy server to block websites listed in file. Here,we will list the website in a file called “restricted-sites.squid”.
In our last post we have already setup the squid transparent proxy. The How to guide will help to install and configure the latest Squid Server.
Advantage of using file listed with restricted websites
(1) We can easily manage and search the website in a file
(2) We can write many website name in the file.Because of this,our squid configuration file looks clean and easy to understand
(As a System Administrator,always try to keep Server configuration file clean and understandable)
Precautions while configuring the Squid server
(1) Always write configuration to its related section. For eg. If you are writing acl ,it should not be written in other section.
(2) The configuration parameters are case sensitive

Squid Proxy Server configuration to block websites listed in a file

Follow the given below steps in Squid Server to block websites which are listed in file.
Step 1: Create a file /etc/squid/restricted-sites.squid. And write website name in the file which you want to block.
For example,I have given website name sharad.me . Like wise you can write as many different website name you want to restrict.
Step 2: Be careful while writing this configuration. Write the configuration which is specific to particular section.
Edit /etc/squid/squid.conf file and write two configuration settings.
In acl section , write a new line
In http_access deny section,write new line
If you are doing this first time, the below screenshot is recommended for you.
Closely see,how the acl section and https_access section has the above given configuration written.
Squid restricted sites
Step 3: Now restart the squid service

No comments: