在Azure上部署squid的教程
来源:互联网 发布:废旧金属行情软件 编辑:程序博客网 时间:2024/05/22 02:03
CentOS部署
首先关闭防火墙:
setenforce 0
设置最大文件数:
ulimit -n 1048576
设置最大文件句柄数:
echo "* soft nofile 1048576" >> /etc/security/limits.confecho "* hard nofile 1048576" >> /etc/security/limits.conf
停止sendmail服务,防止占用25 SMTP端口:
killall sendmail
停止postfix服务,防止占用25 SMTP端口:
/etc/init.d/postfix stop
从Linux运行级关闭postfix服务:
chkconfig --level 2345 postfix off
安装squid:
这里必须用25端口, 别问为什么。。。
yum -y install squid
vim /etc/squid/squid.conf,写入以下内容:
acl manager proto cache_objectacl localhost dst 127.0.0.0/8 0.0.0.0/32 ::1acl SSL_ports port 443acl Safe_ports port 80 # httpacl Safe_ports port 21 # ftpacl Safe_ports port 443 # httpsacl Safe_ports port 70 # gopheracl Safe_ports port 210 # waisacl Safe_ports port 1025-65535 # unregistered portsacl Safe_ports port 280 # http-mgmtacl Safe_ports port 488 # gss-httpacl Safe_ports port 591 # filemakeracl Safe_ports port 777 # multiling httpacl CONNECT method CONNECThttp_access allow manager localhosthttp_access deny managerhttp_access deny !Safe_portshttp_access deny CONNECT !SSL_portshttp_access allow all http_port 25coredump_dir /var/spool/squidrefresh_pattern ^ftp: 1440 20% 10080refresh_pattern ^gopher: 1440 0% 1440refresh_pattern -i (/cgi-bin/|\?) 0 0% 0refresh_pattern (Release|Packages(.gz)*)$ 0 20% 2880refresh_pattern . 0 20% 4320strip_query_terms off
重启squid:
/etc/init.d/squid restart
检查端口是否开启
netstat -ntpl |grep squid
从Linux运行级开启squid服务:
chkconfig --level 2345 squid on
至此,你的服务器就已经部署成了代理服务器。(参考自这里)
加入用户验证
yum install -y openssl openssl-devel httpd
passwd 文件使用 htpasswd 生成,auth_user 替换为自己需要设定的用户名
htpasswd -c /etc/squid/passwd auth_user
vim /etc/squid/squid.conf,写入以下内容:
auth解释:
第一行:选择的认证方式为basic,认证程序路径和密码文件路径。
第二行:认证程序的进程数
第三行:认证有效时间
第四行:认证领域内容,上面定义的web浏览需要输入用户密码
第五,六行:设置允许认证的用户访问
# authauth_param basic program /usr/lib64/squid/ncsa_auth /etc/squid/passwdauth_param basic children 5auth_param basic credentialsttl 2 hoursauth_param basic realm Example.com's Squid proxy-cachingacl auth_user proxy_auth REQUIREDhttp_access allow auth_user# And finally deny all other access to this proxyhttp_access deny all# Squid normally listens to port 3128http_port 25
使用HTTPS
如果要使用https协议则必须找台国内VPS或者自己本机安装Stunnel ,并修改以下配置:
https_port 443 cert=/etc/squid/xx.crt key=/etc/squid/xx.key
上面的密钥文件使用下面的命令来生成
(需要注意的是,Common Name需要与服务器的IP或者主机名一致)
cd /etc/squidopenssl req -new > hb.csropenssl rsa -in privkey.pem -out xx.keyopenssl x509 -in xx.csr -out xx.crt -req -signkey xx.key -days 3650
参考自这里
服务器安装stunnel - linux
yum install -y stunnel 安装killall stunnel 停止stunnel 运行
增加文件/etc/stunnel/tunnel.conf ,配置如下:
[proxy]client = no[squid]accept = 其他端口connect = 127.0.0.1:25cert = /etc/stunnel/stunnel.pem
stunnel.pem生成方法可参考这里
本地安装stunnel -Windows
下载:https://www.stunnel.org/downloads.html
修改关键配置如下:
[proxy]client = yesaccept = 本地:端口connect = 远程:端口
可能用得找的东西 XXXList
- 在Azure上部署squid的教程
- 部署在windows azure上的openvpn
- 在Azure上部署微服务项目的经验分享
- 在Windows Azure虚拟机上的SQL Server新教程
- 在Windows Azure平台上部署服务
- 在Windows Azure平台上部署服务
- 在Windows Azure上部署Linux虚拟机
- 如何在 Azure 上部署 Kubernetes 集群
- 在Azure上实现网站的staging部署和部署交换
- 真实世界的 Windows Azure:在Windows Azure上 Xpertdoc部署它托管的文档输出自动化解决方案
- 在 Windows Azure 上部署预配置 Oracle VM
- 在 Windows Azure 上部署预配置 Oracle VM
- Windows Azure应用系列:在微软云上部署VPN
- 在 Azure 虚拟机上部署反恶意软件解决方案
- 在IIS上部署Django 之 Microsoft Azure
- 在微软Azure的服务器上创建Windows虚拟机的教程
- Azure上部署的资源公网连通性测试工具-psping
- Azure上部署的资源公网连通性测试工具-paping
- TensorFlow安装所遇到的问题
- 程序员软技能
- OnItemClickListener 条目的点击侦听
- JShell
- 《训练指南》大白 二维几何基础 基本公式(模板)
- 在Azure上部署squid的教程
- java中的泛型总结
- RPC应用的java实现
- QT+OpenCv实现在410c开发板上实现视频目标追踪预研——目标跟踪算法选择
- uva 536Tree Recovery
- 在活动中使用menu
- POJ 3273 Conscription(最小生成树)
- java学习之路 之 IO流-练习题
- Spark运行架构