国产xxxx99真实实拍_久久不雅视频_高清韩国a级特黄毛片_嗯老师别我我受不了了小说

資訊專欄INFORMATION COLUMN

利用RouterOS配合squid實現(xiàn)透明緩存

Andrman / 2768人閱讀

摘要:系統(tǒng)版本安裝并開機啟動方式安裝在級別上自動運行服務(wù)修改配置文件并修改為如下配置其他相關(guān)命令檢查命中率查看訪問情況查看命中情況

系統(tǒng)版本:Cent OS 6.9

1.安裝 squid 并開機啟動

yum -y install squid    //yum 方式安裝
chkconfig --level 35 squid on             //在3、5級別上自動運行squid服務(wù)
  

2.修改squid 配置文件并修改為如下配置 vi /etc/squid/squid.conf

# Recommended minimum Access Permission configuration:

# Only allow cachemgr access from localhost
http_access allow manager localhost
http_access deny manager

# Deny requests to certain unsafe ports
http_access deny !Safe_ports

# Deny CONNECT to other than secure SSL ports
http_access deny CONNECT !SSL_ports

# We strongly recommend the following be uncommented to protect innocent
# web applications running on the proxy server who think the only
# one who can access services on "localhost" is a local user
#http_access deny to_localhost
#
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
#
# Example rule allowing access from your local networks.
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed
http_access allow localnet
http_access allow localhost

# And finally deny all other access to this proxy
http_access deny all

# Squid normally listens to port 3128
http_port 3128  transparent

# Uncomment and adjust the following to add a disk cache directory.
cache_dir ufs /mnt/squid 1000000 16 256
cache_mem 300000 MB
maximum_object_size_in_memory 1 MB
maximum_object_size 2 GB
max_filedesc 45000
logformat combined %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %h" "%{User-Agent}>h" %Ss:%Sh
access_log /var/log/squid/access.log combined
cache_log /var/log/squid/cache.log
hierarchy_stoplist cgi-bin ?

#acl QUERY urlpath_regex cgi-bin ?
acl BIGMEDIA urlpath_regex -i .rmvb$ .avi$ .mpg$ .mkv$ .rm$

#acl WEBMAIL dstdom_regex -i "/usr/local/squid/etc/webmails"
#cache deny WEBMAIL
#cache deny QUERY
cache deny BIGMEDIA
cache allow all
cache_swap_high 95
cache_swap_low 90
cache_mgr  123@123.com
cache_effective_user squid
quick_abort_min -1 KB
range_offset_limit -1
refresh_pattern -i .htm$ 5 20% 1440
refresh_pattern -i .html$ 5 20% 1440
refresh_pattern -i .jpeg$ 60 50% 4320 reload-into-ims
refresh_pattern -i .jpg$ 60 50% 4320 reload-into-ims
refresh_pattern -i .png$ 60 50% 4320 reload-into-ims
refresh_pattern .flv?start 0 0% 0
refresh_pattern .flv?ref  0 0% 0
refresh_pattern .f4v?ref  0 0% 0
refresh_pattern .mp4?ref  0 0% 0
refresh_pattern .flv? 1440 99% 10080 reload-into-ims ignore-reload ignore-no-cache
refresh_pattern .flv$ 1440 99% 10080 reload-into-ims ignore-reload ignore-no-cache
refresh_pattern .f4v? 1440 99% 10080 reload-into-ims ignore-reload ignore-no-cache
refresh_pattern .mp4? 1440 99% 10080 reload-into-ims ignore-reload ignore-no-cache
refresh_pattern .m4v? 1440 99% 10080 reload-into-ims ignore-reload ignore-no-cache
refresh_pattern .swf$ 1440 99% 10080 reload-into-ims ignore-reload ignore-no-cache

# Leave coredumps in the first cache dir
coredump_dir /home/squid01

# Add any of your own refresh_pattern entries above these.
#refresh_pattern .(jpg|png|gif|mp3|xml)1440    50%     2880   ignore-reload
refresh_pattern ^ftp:           1440    20%     10080
refresh_pattern ^gopher:        1440    0%      1440
refresh_pattern -i (/cgi-bin/|?) 0     0%      0
refresh_pattern .               0       20%     4320    

其他相關(guān)命令

檢查命中率    squidclient  -h 127.0.0.1 -p 3128 mgr:info
查看訪問情況    tail -f /var/log/squid/access.log
查看命中情況    tail -f /var/log/squid/access.log | grep HIT

3.檢查 squid 配置是否正常,如沒問題則啟動服務(wù)

squid -z  //根據(jù)反饋提示修改配置文件
service squid start
chkconfig squid on

4.編輯iptables 文件,插入如下配置并重啟

vi /etc/sysconfig/iptables
service iptables restart 

*nat
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A PREROUTING -s 192.168.1.0/24 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3128  //重定向ros路由過來的內(nèi)網(wǎng)80端口的流量到 squid的3128端口   根據(jù)實際情況調(diào)整來源網(wǎng)段
COMMIT

注意:如果緩存使用外部掛載存儲,請關(guān)閉 SElinux

setenforce 0 && sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config

RouterOS 上面的配置 根據(jù)實際情況修改為IP地址

ip route add dst-address=0.0.0.0/0 gateway=192.168.1.2 routing-mark=squid check-gateway=ping  //添加一條默認路由到代理服務(wù)器并添加標簽為squid,用ping的方式檢查網(wǎng)關(guān)  根據(jù)實際情況調(diào)整來源網(wǎng)段
ip firewall address-list add address=192.168.1.1 list=noproxy    //加入網(wǎng)關(guān)地址和代理服務(wù)器地址
ip firewall address-list add address=192.168.1.2 list=noproxy    
ip firewall mangle add src-address=192.168.1.0/24 dst-address-list=noproxy protocol=tcp dst-port=80 action=mark-routing new-routing-mark=squid    //把來源內(nèi)網(wǎng)段80端口的流量轉(zhuǎn)發(fā)到代理服務(wù)器上面并排除之前加入的網(wǎng)關(guān)和服務(wù)器IP

文章版權(quán)歸作者所有,未經(jīng)允許請勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉(zhuǎn)載請注明本文地址:http://specialneedsforspecialkids.com/yun/62017.html

相關(guān)文章

  • 運維-服務(wù)器緩存之varnish

    摘要:如帶有如下頭信息,,默認不會緩存。是一款高性能開源的反向代理服務(wù)器和緩存服務(wù)器,其開發(fā)者是核心的開發(fā)人員之一。備份復制備份用默認端口開啟你會得到如下信息我們看到,已經(jīng)開啟,但是除了知道這個東西已經(jīng)監(jiān)聽端口外,我們不知道發(fā)生了什么。 varnish 小草新blog: http://homeway.me/ 一、介紹下吧: 首先了解幾個概念, 1. Varnish不緩存帶有...

    leanote 評論0 收藏0
  • 后端好書閱讀與推薦(續(xù))

    摘要:續(xù)前文后端好書閱讀與推薦,幾十天過去了,又看了兩本好書還有以前看過的書,這里依然把它們總結(jié)歸納一下,加入一些自己的看法有用的鏈接和可能的延伸閱讀,并推薦給需要的同學。 續(xù)前文 后端好書閱讀與推薦 - Mageek`s Wonderland ,幾十天過去了,又看了兩本好書(還有以前看過的書),這里依然把它們總結(jié)歸納一下,加入一些自己的看法、有用的鏈接和可能的延伸閱讀,并推薦給需要的同學。...

    劉福 評論0 收藏0

發(fā)表評論

0條評論

最新活動
閱讀需要支付1元查看
<