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.
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)
(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
(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.
For example,I have given website name sharad.me . Like wise you can write as many different website name you want to restrict.
1
2
3
4
5
|
vi /etc/squid/restricted-sites.squid
sharad.me
www.sharad.me
http://sharad.me
|
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
1
|
acl blocksites dstdomain "/etc/squid/restricted-sites.squid"
|
In http_access deny section,write new line
1
|
http_access deny blocksites
|
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.
Closely see,how the acl section and https_access section has the above given configuration written.
Step 3: Now restart the squid service
1
|
/etc/init.d/squid restart
|
No comments:
Post a Comment