溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

Linux服務(wù)器設(shè)置squid連接限制

發(fā)布時(shí)間:2021-09-15 09:54:05 來源:億速云 閱讀:250 作者:chen 欄目:建站服務(wù)器

本篇內(nèi)容主要講解“Linux服務(wù)器設(shè)置squid連接限制”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實(shí)用性強(qiáng)。下面就讓小編來帶大家學(xué)習(xí)“Linux服務(wù)器設(shè)置squid連接限制”吧!

Squid連接限制

Squid可以有效的限制連接,指定哪些用戶可以連接,指定哪些網(wǎng)站可以訪問,這樣就可以有效的利用服務(wù)器帶寬。

1、限制指定網(wǎng)段不能連接。編輯配置文件”/etc/squid/squid.conf”,利用acl語言添加受限制的ip地址

[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

停止 squid................                               [確定]

正在啟動 squid.                                          [確定]

重啟squid之后,使用這個(gè)代理的瀏覽器將不能訪問任何網(wǎng)頁

Linux服務(wù)器設(shè)置squid連接限制

2、限制某個(gè)ip不能使用呢,和上面的一樣使用acl語法  

[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

停止 squid................                               [確定]

正在啟動 squid.                                          [確定]

重啟squid之后,IP地址為“192.168.0.113”的電腦如果用了這個(gè)代理,那么它將不能訪問網(wǎng)站

3、限制某些網(wǎng)站不能訪問

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

acl domaindeny dstdomain .baidu.com

http_access deny domaindeny

 

[root@localhost   wj]# service squid restart

停止 squid................                               [確定]

正在啟動 squid.                                          [確定]

重啟squid之后,使用這個(gè)代理的瀏覽器將不能訪問百度

Linux服務(wù)器設(shè)置squid連接限制

4、網(wǎng)站黑名單,可以通過一個(gè)網(wǎng)站列表文件形成網(wǎng)站黑名單,這些網(wǎng)站將不能被訪問。

1)在/etc/squid目錄下創(chuàng)建愛你一個(gè)文件denyurl,在此文件內(nèi)輸入要攔截的網(wǎng)站

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

.baidu.com

.hao123.com

 

[root@localhost   wj]# service squid restart

停止 squid................                               [確定]

正在啟動 squid.                                          [確定]

2)修改配置文件“/etc/squid/squid.conf”

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

acl denyurl url_regex "/etc/squid/denyurl"     //注意這個(gè)路徑就是上面定義的文件路徑

http_access deny denyurl

 

[root@localhost   wj]# service squid restart

停止 squid................                               [確定]

正在啟動 squid.                                          [確定]

3)訪問百度和hao123

Linux服務(wù)器設(shè)置squid連接限制

5、限制某個(gè)時(shí)間段內(nèi)不能連接 

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

acl timedeny time M 10:00-17:00      //M周一  T周二   W周三   H周四   F周五   A周六    S周日

http_access deny clientdeny

 

[root@localhost   wj]# service squid restart

停止 squid................                               [確定]

正在啟動 squid.                                          [確定]

重啟squid之后,使用這個(gè)電腦的代理將無法再星期一的10~17點(diǎn)上網(wǎng)

     Linux服務(wù)器設(shè)置squid連接限制

到此,相信大家對“Linux服務(wù)器設(shè)置squid連接限制”有了更深的了解,不妨來實(shí)際操作一番吧!這里是億速云網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI