第一步,先更新下系统
yum upgrade -y
然后,我们开始安装squid
setenforce 0 ulimit -n 1048576 echo "* soft nofile 1048576" >> /etc/security/limits.conf echo "* hard nofile 1048576" >> /etc/security/limits.conf echo "alias net-pf-10 off" >> /etc/modprobe.d/dist.conf echo "alias ipv6 off" >> /etc/modprobe.d/dist.conf killall sendmail /etc/init.d/postfix stop chkconfig --level 2345 postfix off yum -y install squid wget -O /etc/squid/squid.conf http://www.rpsofts.com/vvv/squid/centos-squid.conf #作者提供的配置文件 mkdir -p /var/cache/squid chmod -R 777 /var/cache/squid squid -z service squid restart chkconfig --level 2345 squid on
装完后记得reboot重启下服务器确保生效
注意,配置文件中配置的代理端口是25,你可以自行修改为其他端口,找到
http_port 25
将25改为其他数字,改为记得重启,重要的一点,你使用的端口一定要在 防火墙中开放
/sbin/iptables -I INPUT -p tcp --dport 25 -j ACCEPT service iptables save
至此我们的squid搭建就完成了
提供一个原作者提供的PAC文件,请自行修改服务器ip和端口为你自己的。
https://github.com/rptec/squid-PAC
squid 反向代理不错。