标签:主机
######################squid#######################
[root@foundation75 Desktop]# yum install -y squid
[root@foundation75 Desktop]# systemctl start squid
[root@foundation75 Desktop]# netstat -antlpe | grep squid
tcp6 0 0 :::3128 :::* LISTEN 0 89631 7155/(squid-1)
[root@foundation75 Desktop]# vim /etc/squid/squid.conf
58 http_access allow all ##允许所有主机访问
64 cache_dir ufs /var/spool/squid 100 16 256
[root@foundation75 Desktop]# systemctl restart squid.service
测试
[root@foundation75 Desktop]# vim /etc/squid/squid.conf
52 acl badurl dstdomain .baidu.com
53 http_access deny badurl ##禁止baidu访问,但其他可以访问
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
64 #cache_dir ufs /var/spool/squid 100 16 256
[root@foundation75 Desktop]# systemctl restart squid.service
测试
###############cdn反向加速##########
cdn反向加速原理:建立一个反向代理节点,客户端需要什么东西,直接访问代理节点,代理节点去服务端获取并进行缓存,这样就间接性的从服务端获取了信息,并且获取速度比较快
yum install -y squid
systemctl start squid
systemctl stop firewalld
netstat -antple | grep squid
vim /etc/squid/squid.conf
# And finally deny all other access to this proxy
56 http_access allow all
57
58 # Squid normally listens to port 3128
59 http_port 80 vhost vport
60 cache_peer 172.25.254.136 parent 80 0 no-query
systemctl restart squid
#############平分主机访问的压力########
vim /etc/squid/squid.conf
# And finally deny all other access to this proxy
http_access allow all
# Squid normally listens to port 3128
http_port 80 vhost vport
cache_peer 172.25.254.111 parent 80 0 no-query originserver name=web1 round-robin weight=3
cache_peer 172.25.254.124 parent 80 0 no-query originserver name=web2 round-robin weight=1
cache_peer_domain www.westos.com web1 web2
标签:主机
原文地址:http://12920735.blog.51cto.com/12910735/1926843