Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Linux server sets squid connection limits

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report