Get the App
SLTechnology News&Howtos  ›  Servers  › 

Linux server sets squid connection limits

Shulou Source: shulou.com Published: 2022-06-01 10:48:28 10月01日 Update

This article focuses on "setting squid connection restrictions on Linux servers". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "setting squid connection restrictions on Linux servers".

Squid connection limit

Squid can effectively restrict connections, specify which users can connect, and specify which websites can be accessed, so that server bandwidth can be effectively utilized.

1. The specified network segment cannot be connected. Edit the configuration file "/ etc/squid/squid.conf" to add restricted ip addresses using ACL language

[root@localhost wj] # gedit / etc/squid/squid.conf

Acl clientdeny src 192.168.0.1-192.168.0.200

Http_access deny clientdeny

[root@localhost wj] # service squid restart

Stop squid:. [OK]

Starting squid:. [OK]

After restarting squid, browsers using this agent will not be able to access any web pages

2. Restrict that a certain ip cannot be used, and use ACL syntax as above

[root@localhost wj] # gedit / etc/squid/squid.conf

Acl clientdeny src 192.168.0.113

Http_access deny clientdeny

[root@localhost wj] # service squid restart

Stop squid:. [OK]

Starting squid:. [OK]

After restarting squid, a computer with IP address "192.168.0.113" will not be able to access the website if it uses this agent

3. Restrict access to some websites

[root@localhost wj] # gedit / etc/squid/squid.conf

Acl domaindeny dstdomain .baidu.com

Http_access deny domaindeny

[root@localhost wj] # service squid restart

Stop squid:. [OK]

Starting squid:. [OK]

After restarting squid, browsers using this proxy will not be able to access Baidu

4, website blacklist, can form a website blacklist through a website list file, these websites will not be visited.

1) create a love file denyurl in the / etc/squid directory, and enter the website to be blocked in this file

[root@localhost wj] # gedit / etc/squid/denyurl

.baidu.com

.hao123.com

[root@localhost wj] # service squid restart

Stop squid:. [OK]

Starting squid:. [OK]

2) modify configuration file "/ etc/squid/squid.conf"

[root@localhost wj] # gedit / etc/squid/squid.conf

Acl denyurl url_regex "/ etc/squid/denyurl" / / Note that this path is the file path defined above.

Http_access deny denyurl

[root@localhost wj] # service squid restart

Stop squid:. [OK]

Starting squid:. [OK]

3) visit Baidu and hao123

5. Limit that you cannot connect within a certain period of time.

[root@localhost wj] # gedit / etc/squid/squid.conf

Acl timedeny time M 10:00-17:00 / M Monday T Tuesday W Wednesday H Thursday F Friday A Saturday S Sunday

Http_access deny clientdeny

[root@localhost wj] # service squid restart

Stop squid:. [OK]

Starting squid:. [OK]

After restarting squid, agents using this computer will no longer be able to access the Internet at 10: 17 on Monday.

At this point, I believe you have a deeper understanding of "Linux server setting squid connection restrictions". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Restrictions websites files ongoing servers services proxies valid content addresses browsers computers paths blacklists blacknames learning browsing configuration practical deeper Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Shulou Information Linux OPPO Reno Docker