笔记整理squid代理加速网站


yum -y install squid
1.基于ip的转发支持php本机ip为63 vi
/etc/squid/squid.conf http_port 80 accel vhost vport#开启代理加速 cache_dir ufs /var/spool/squid 100 16 256#100缓存目录占磁盘空间大小(M)16 :缓存空间一级子目录个数 256 :缓存空间二级子目录个数 cache_peer 192.168.1.62 parent 80 0 no-query originserver name=test1 access_log /var/log/squid/access.log acl localnet src 192.168.1.0/24 http_access allow localnet# 允许局域网用户的请求 http_access deny all#访问控制 visible_hostname node63.cn#可见的主机名 cache_mgr wangshibo@huanqiu.com#定义管理员邮箱
systemctl restart squid 重启 squid
-z 重置

 

2.基于域名的配置

vi /etc/squid/squid.conf

http_port 80 accel vhost 
http_access allow all 
cache_peer 192.168.1.18 parent 80 0 originserver name=www 
cache_peer 192.168.1.19 parent 80 0 originserver name=bbs 
cache_peer_domain www www.squid.dev 
cache_peer_domain bbs bbs.squid.dev 
visible_hostname node63.cn
cache_mgr wangshibo@huanqiu.com
cache_log /var/log/cache.log

 

另一种写法基于ip

vi /etc/squid/squid.conf

visible_hostname node63.cn
http_port 80 accel vhost vport
cache_peer 192.168.210.111 parent 80 0 no-query originserver name=test1
acl all src 0.0.0.0/0.0.0.0
http_access allow all
cache_log /var/log/cache.log


dz论坛外面访问配置

vi /etc/squid/squid.conf
http_port 80 accel vhost vport
cache_dir ufs /var/spool/squid 100 16 256
cache_peer 192.168.1.62 parent 80 0 no-query originserver name=test1
access_log /var/log/squid/access.log
acl localnet src all
http_access allow localnet
http_access deny all
visible_hostname node63.cn
cache_mgr wangshibo@huanqiu.com

systemctl restart squid

squid -z

 

 

 

 

参考

 squid

清除缓存

https://www.cnblogs.com/kevingrace/p/5991582.html

https://www.cnblogs.com/yingsong/p/4929482.html

https://blog.csdn.net/yff1030/article/details/8835605

https://wiki.squid-cache.org/ConfigExamples#Online_Manuals

加速配置

https://www.linuxidc.com/Linux/2017-05/143460.htm

https://www.linuxidc.com/Linux/2016-10/136594.htm

有参数说明

https://blog.51cto.com/wks97/2051048

posted @ 2019-03-26 23:06  夜辰雪扬  阅读(188)  评论(0)    收藏  举报