三、nginx代理功能

目录

  • SQUID代理服务器配置
    • 安装squid
    • 编辑squid配置文件
  • 定义拒绝访问
    • 启动squid服务
  • linux客户端配置
    • linux客户端配置正向代理
    • 测试http
    • 代理服务器上查看日志/var/log/squid/access.log
  • windows 也可以配置网页代理

SQUID代理服务器配置

安装squid

yum install squid -y 

编辑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 

定义拒绝访问

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

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

http_access deny deny_keyword

# 定义好了 之后要重启 服务器
systemctl restart squid

三、nginx代理功能_第1张图片
三、nginx代理功能_第2张图片

启动squid服务

systemctl start squid 
systemctl enable squid 

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

测试http

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

三、nginx代理功能_第3张图片
可以看到 403

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

cat /var/log/squid/access.log

三、nginx代理功能_第4张图片

windows 也可以配置网页代理

三、nginx代理功能_第5张图片

三、nginx代理功能_第6张图片
三、nginx代理功能_第7张图片


本章完结

你可能感兴趣的:(运维服务,nginx,运维)