当前位置:   article > 正文

三、nginx代理功能_nginx转发squid请求

nginx转发squid请求

SQUID代理服务器配置

安装squid

yum install squid -y 
  • 1

编辑squid配置文件

#vim /etc/squid/squid.conf 
acl local src 192.168.0.0/24   	   //允许192.168.0.0/24网段内所有客户机访问代理服务器


http_access allow local 		  //该记录一定要添在deny all之前
http_port 3128 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

定义拒绝访问

# 这一行是定义
acl {定义名字} url_regex -i {关键字}
acl deny_keyword url_regex -i jd.com

# 这一行是调用自己定义的
http_access deny {定义名字}

http_access deny deny_keyword

# 定义好了 之后要重启 服务器
systemctl restart squid
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

在这里插入图片描述
在这里插入图片描述

启动squid服务

systemctl start squid 
systemctl enable squid 
  • 1
  • 2

linux客户端配置

linux客户端配置正向代理

export http_proxy=http://192.168.0.109:3128
export https_proxy=http://192.168.0.109:3128
echo "export http_proxy=http://192.168.0.109:3128" >>/etc/profile
echo "export https_proxy=http://192.168.0.109:3128" >>/etc/profile

  • 1
  • 2
  • 3
  • 4
  • 5

测试http

  wget http://www.jd.com/index.php
  • 1

在这里插入图片描述
可以看到 403

代理服务器上查看日志/var/log/squid/access.log

cat /var/log/squid/access.log
  • 1

image-20200624010413285

windows 也可以配置网页代理

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述


本章完结

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/706157
推荐阅读
相关标签
  

闽ICP备14008679号