基于CentOS的Squid普通代理实现
基于CentOS的Squid普通代理实现
网络配置如上图所示 Squid使用CentOS5.8+squid,web服务器使用FreeBSD+nginx进行试验。
本地网络使用VMnet1进行模拟,公网使用VMnet2进行模拟,IP规划如上图。
首先安装web服务器,网络选择接入Vmnet2.
pkg_add -r //安装nginx
ifconfig le0 200.98.1.1 netmask 255.255.255.0 up //配置网络
/usr/local/rc.d/nginx start //启动nginx进程
至此 web服务器准备完毕。
www.2cto.com
接下来准备squid代理服务器。
1.安装squid软件
#yum -y install squid
2.配置/etc/squid/squid.conf文件的书写
http_port 192.168.3.1:3128 //代理服务器开启端口设置
visible_hostname 192.168.3.1 //代理服务器标示(必须配置,否则会报错)
//配置ACL(必须)
acl innet src 192.168.3.0/24
acl all src 0.0.0.0/0.0.0.0
http_access allow innet
http_access deny all
3.配置服务器网络 www.2cto.com
ifconfig etho 192.168.3.1 netmask 255.255.255.0 up
ifconfig eth1 200.98.1.2 up
4.启动squid代理服务端 service squid start 5.关闭防火墙 iptabes iptables -F 至此 squid服务器准备完毕 最后配置客户端浏览器
测试,成功访问到之前架设的web服务器 www.2cto.com
评论暂时关闭