日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

3-squid服务

發(fā)布時(shí)間:2025/3/21 编程问答 16 豆豆
生活随笔 收集整理的這篇文章主要介紹了 3-squid服务 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

######squid正向代理######

##借助代理訪問客戶端訪問不到的地址

1.安裝服務(wù)

yum install squid -y

systemctl start squid

2.##第三方主機(jī)訪問網(wǎng)絡(luò)

vim /etc/squid/squid.conf

?

?52 http_access allow localnet

?53 http_access allow localhost

?54

?55 # And finally deny all other access to this proxy

?56 http_access allow all ????##允許所有http服務(wù)訪問

?57

?58 # Squid normally listens to port 3128

?59 http_port 3128##訪問端口3128

?60

?61 # Uncomment and adjust the following to add a disk cache directory.

?62 cache_dir ufs /var/spool/squid 100 16 256 ?##查詢的目錄和文件數(shù)目

?63

systemctl restart squid ??##重啟服務(wù)

?

測(cè)試:

瀏覽器設(shè)置Advance >Network >Setings

?訪問:www.taobao.com


3.##訪問不了www.baiducom,其余都可以

vim /etc/squid/squid.conf

?

?52 acl badurl dst ?www.baidu.com? ??????

?53 http_access deny badurl????????##www.baidu.com加入黑名單

?54 http_access allow localnet

?55 http_access allow localhost

?56

?57 # And finally deny all other access to this proxy

?58 http_access deny all

?59

?60 # Squid normally listens to port 3128

?61 http_port 3128

?62

?63 # Uncomment and adjust the following to add a disk cache directory.

?64 cache_dir ufs /var/spool/squid 100 16 256

?65

?

systemctl restart squid



4.##訪問不了baidu的網(wǎng)絡(luò)

vim /etc/squid/squid.conf ?

?

?52 acl badurl dstdomain ?.baidu.com

?53 http_access deny badurl????????##.baidu.com加入黑名單

?54 http_access allow localnet

?55 http_access allow localhost

?56

?57 # And finally deny all other access to this proxy

?58 http_access deny all

?59

?60 # Squid normally listens to port 3128

?61 http_port 3128

?62

?63 # Uncomment and adjust the following to add a disk cache directory.

?64 cache_dir ufs /var/spool/squid 100 16 256

?65

?

systemctl restart squid

?

?

########squid反向代理#######

vim /etc/squid/squid.conf

?59 http_port 80 vhost vport##反向代理端口為80

?60 cache_peer 172.25.254.134 ?parent 80 0 no-query ???##設(shè)置訪問域名的ip為172.25.254.134 端口80 no-query不查詢

?61

systemctl restart squid

?


#####平分訪問主機(jī)的壓力#######

?

vim /etc/squid/squid.conf

59 http_port 80 vhost vport

60 cache_peer 172.25.254.134 ?parent 80 0 no-query originserver name=web1 round-robin weight=3??

##設(shè)置訪問域名的ip為172.25.254.134 端口80 no-query不查詢,直接獲取數(shù)據(jù),名字web1,round-robin輪流查詢,web1三次

61 cache_peer 172.25.254.111 ?parent 80 0 no-query originserver name=web2 round-robin weight=1

##設(shè)置訪問域名的ip為172.25.254.111 端口80 no-query不查 詢,直接獲取數(shù)據(jù),名字web2,round-robin輪流查詢,web2一次

62 cache_peer_domain www.westos.com web1 web2 ?##指定域名www.westos.com訪問的ip是web1和web2

?

systemctl restart squid

?


瀏覽器訪問

vim /etc/hosts

172.25.254.111 www.westos.com

172.25.254.134 www.westos.com

?

訪問:www.westos.com

訪問172.25.254.134 三次

訪問172.25.254.134 一次

轉(zhuǎn)載于:https://blog.51cto.com/cuijb/1926828

總結(jié)

以上是生活随笔為你收集整理的3-squid服务的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。