---------------------------------squid---------------------------------
[root@foundation43 Desktop]# yum install squid -y ##安装代理软件
[root@foundation43 Desktop]# systemctl start squid
[root@foundation43 Desktop]# vim /etc/squid/squid.conf
acl badurl dstdomain .baidu.com ##拒绝.baidu站点访问
http_access deny badurl
http_access allow localnet
http_access allow localhost
http_access allow all ##允许所以人访问
cache_dir ufs /var/spool/squid 100 16 256 ##默认缓存目录 100M 16一级目录 256二级目录
[root@foundation43 Desktop]# systemctl restart squid
测试
虚拟机打开 firefox
>Edit
>preferences
>advanced
>network
>setting
>manual proxy configuration
>http proxy :172.25.254.43 port:3128
>ok
访问 www.baidu.com
------------------------------反向代理-------------------------------------
1 重置desktop
2.yum install squid -y
systemctl start squid
3.vim /etc/squid/squid.conf
4.vim /etc/squid/squid.conf
>http_access allow all
# Squid normally listens to port 3128http_port 80 vhost vport
cache_peer 172.25.254.124 parent 80 0 no-query originserver name=web1 round-robin
cache_peer 172.25.254.121 parent 80 0 no-query originserver name=web2 round-robin
cache_peer_domain www.westos.com web1 web2
# Uncomment and adjust the following to add a disk cache directory.
cache_dir ufs /var/spool/squid 100 16 256
systemctl restart squid
vim /etc/host
172.25.254.143 www.westos.com
测试
www.westos.com
最后
以上就是轻松小猫咪最近收集整理的关于Linux学习篇第三章之~squid的全部内容,更多相关Linux学习篇第三章之~squid内容请搜索靠谱客的其他文章。
发表评论 取消回复