使用 squid 2.7 for windows 进行无缓存反向代理

原文:http://www.opent.cn/a/106/2571.shtml 

一.下载squid for windows

       下载地址:http://squid.acmeconsulting.it/download/dl-squid.html
二.安装与配置
   1.解压squid-2.7.STABLE7-bin.zip到C:\squid
      2.单击[开始],选择“运行”,输入 cmd ,在命令提示符窗口内输入以下命令: 
      C:\>cd c:\squid\etc 
      C:\squid\etc>copy squid.conf.default squid.conf     
                   **将Squid的默认配置文件复制一份并起名为squid.conf 
      C:\squid\etc>copy mime.conf.default mime.conf  
                    **将mime.conf.default复制一份并起名为mime.conf 
      3.编辑squid.conf,可把原来文件清空修改成以下内容,再根据你的情况修改成适合你用的配置文件# squid 2.7



# 只提供对外反向代理,禁用了缓存功能。

# 使用默认端口80

# 访问规则默认为 "http_access deny all"

#

# by 青云 QQ285584

#

#

# 本机IP : 192.168.0.11

# 要转向的内网服务器IP : 192.168.0.88

# 网关映射 : 内网80端口---本机80端口



# 基本acl

acl all src all

acl localhost src 127.0.0.1/255.255.255.255

acl localnet src 192.168.0.88/255.255.255.0



# 允许所有访问

#http_access allow all



# 允许内网服务器到本机80端口的代理

acl Safe_ports port 3128

acl Safe_ports port 80

acl Safe_ports port 81

http_access allow Safe_ports

http_access allow localnet



# 防止被人利用为HTTP代理,设置允许访问的IP地址

#acl myip dst 192.168.0.0/32

#http_access deny !myip



# 允许本地管理

#acl manager proto cache_object

#http_access allow manager localhost



# Squid信息设置

visible_hostname qingyun

cache_mgr fhcmail@qq.com



# 单台使用,不使用该功能

icp_port 0



# 禁止磁盘缓存

cache_dir null /tmp



# 禁止缓存本地web server

acl localserver dst 192.168.0.0/32

no_cache deny localserver



# 监听服务器的80端口,透明代理

http_port 80 transparent



# web反向代理

# 这里填写你的内网服务器IP和对应的域名

# -----------------------------------------------------------------------------

cache_peer 192.168.0.88 parent 80 0 no-query originserver name=a.com

cache_peer 192.168.0.88 parent 81 0 no-query originserver name=www.a.com

cache_peer 192.168.0.4 parent 80 0 no-query originserver name=b.com

cache_peer_domain a.com a.com

cache_peer_domain b.com b.com

cache_peer_domain www.a.com www.a.com
复制代码4.从命令行到c:\squid\sbin目录下执行 
     squid -i           注:squid -i -n dnt_squid (命名squid服务的新名称)       squid -r -n dnt_squid (删除指定名称的服务) 
     squid -z 
      安装完成 

5.从服务里启动squid   或在cmd下: net start dnt_squid (启动), net stop dnt_squid (关闭) 
     访问squid服务器:
整个反向代理访问的流程是:
用户请求b.com - 本机host解析为127.0.0.1 - squid服务器 - DNS服务器(解析到192.168.0.4) - 内网web服务器

     如果把#http_access deny all打开把http_access allow all注释掉,你的访问就会被拒绝 
使用 squid 2.7 for windows 进行无缓存反向代理

使用 squid 2.7 for windows 进行无缓存反向代理

一.下载squid for windows
       下载地址:http://squid.acmeconsulting.it/download/dl-squid.html
二.安装与配置
   1.解压squid-2.7.STABLE7-bin.zip到C:\squid
      2.单击[开始],选择“运行”,输入 cmd ,在命令提示符窗口内输入以下命令: 
      C:\>cd c:\squid\etc 
      C:\squid\etc>copy squid.conf.default squid.conf     
                   **将Squid的默认配置文件复制一份并起名为squid.conf 
      C:\squid\etc>copy mime.conf.default mime.conf  
                    **将mime.conf.default复制一份并起名为mime.conf 
      3.编辑squid.conf,可把原来文件清空修改成以下内容,再根据你的情况修改成适合你用的配置文件# squid 2.7



# 只提供对外反向代理,禁用了缓存功能。

# 使用默认端口80

# 访问规则默认为 "http_access deny all"

#

# by 青云 QQ285584

#

#

# 本机IP : 192.168.0.11

# 要转向的内网服务器IP : 192.168.0.88

# 网关映射 : 内网80端口---本机80端口



# 基本acl

acl all src all

acl localhost src 127.0.0.1/255.255.255.255

acl localnet src 192.168.0.88/255.255.255.0



# 允许所有访问

#http_access allow all



# 允许内网服务器到本机80端口的代理

acl Safe_ports port 3128

acl Safe_ports port 80

acl Safe_ports port 81

http_access allow Safe_ports

http_access allow localnet



# 防止被人利用为HTTP代理,设置允许访问的IP地址

#acl myip dst 192.168.0.0/32

#http_access deny !myip



# 允许本地管理

#acl manager proto cache_object

#http_access allow manager localhost



# Squid信息设置

visible_hostname qingyun

cache_mgr fhcmail@qq.com



# 单台使用,不使用该功能

icp_port 0



# 禁止磁盘缓存

cache_dir null /tmp



# 禁止缓存本地web server

acl localserver dst 192.168.0.0/32

no_cache deny localserver



# 监听服务器的80端口,透明代理

http_port 80 transparent



# web反向代理

# 这里填写你的内网服务器IP和对应的域名

# -----------------------------------------------------------------------------

cache_peer 192.168.0.88 parent 80 0 no-query originserver name=a.com

cache_peer 192.168.0.88 parent 81 0 no-query originserver name=www.a.com

cache_peer 192.168.0.4 parent 80 0 no-query originserver name=b.com

cache_peer_domain a.com a.com

cache_peer_domain b.com b.com

cache_peer_domain www.a.com www.a.com
复制代码4.从命令行到c:\squid\sbin目录下执行 
     squid -i           注:squid -i -n dnt_squid (命名squid服务的新名称)       squid -r -n dnt_squid (删除指定名称的服务) 
     squid -z 
      安装完成 

5.从服务里启动squid   或在cmd下: net start dnt_squid (启动), net stop dnt_squid (关闭) 
     访问squid服务器:
整个反向代理访问的流程是:
用户请求b.com - 本机host解析为127.0.0.1 - squid服务器 - DNS服务器(解析到192.168.0.4) - 内网web服务器

     如果把#http_access deny all打开把http_access allow all注释掉,你的访问就会被拒绝 
原文地址:https://www.cnblogs.com/ssjylsg/p/2124228.html