更换了一台阿里云服务器,从新部署服务。直接上了CentOS8系统。php
CentOS8系统除了默认的pyhton版本是 Python 3.6 ,RHEL 包含PHP 7.2。html
结果,原来的python2的服务都要从新兼容一次python3,也懒得再去安装pyhton2版本。python
更重要的是,本来代理服务Tinyproxy,在CentOS8上面,不管是rpm安装,仍是源码安装最新版本Version 1.10.0,都起不来!!!linux
Tinyproxy git地址:https://github.com/tinyproxy
rpm支持EPEL 7 for x86_64的版本:tinyproxy-1.8.3-2.el7.x86_64.rpmgit
不是 PID 未建立,就是 protocol错误。github
本想开--enable-debug调试模式研究下, 看下怎么解决。可是业务优先,马上更换代理,换上 squid。shell
squid Squid是一个高性能的代理缓存服务器,Squid支持FTP、gopher、HTTPS和HTTP协议。和通常的代理缓存软件不一样,Squid用一个单独的、非模块化的、I/O驱动的进程来处理全部的客户端请求。vim
squid官网:http://www.squid-cache.org/缓存
squid下载地址:http://www.squid-cache.org/Versions/服务器
squid的rpm文件:http://rpmfind.net/linux/rpm2html/search.php?query=squid
服务器环境:
$ cat /etc/redhat-release CentOS Linux release 8.1.1911 (Core)
yum源中的版本:
$ yum list | grep squid squid.x86_64 7:4.4-8.module_el8.1.0+197+0c39cdc8 @AppStream squidGuard.x86_64 1.4-36.el8 epel
直接yum安装:
$ yum install -y squid
查看已安装:
$ whereis squid
查看启动脚本:
$ ll /usr/lib/systemd/system | grep squid
进入配置文件目录:
$ cd /etc/squid/
编辑配置文件,容许全部ip访问:
$ vim squid.conf http_port 3228 # 修改端口,默认为 3128 http_access allow all # 添加 ,为容许全部ip
检查配置文件是否有误:
$ squid -k parse # 配置文件解析日志中,没有出现ERROR 就没有问题
启动服务:
$ systemctl start squid ```shell 查看squid监听的端口: ```shell $ netstat -lnpt
squid的日志目录为/var/log/squid/, 两种类型日志access 和cache; 使用代理 http 或 https:
公网IP:监听端口
管理命令:
$ squid -k parse # 检查配置文件是否有误 $ systemctl start squid # 启动 squid $ systemctl status squid # 查看 squid 运行状态 $ systemctl stop squid # 中止 squid $ systemctl restart squid # 重启 squid
$ cat /etc/squid/squid_allow_ips 1.2.3.4 2.2.3.4 3.2.3.4
acl allowed_ips src "/etc/squid/squid_allow_ips" # ip白名单 http_access allow localnet http_access allow localhost http_access allow allowed_ips # 配置allow # And finally deny all other access to this proxy http_access deny all # 禁止全部访问,这个不要漏了
3. 检查配置文件是否有误:
$ squid -k parse # 配置文件解析日志中,没有出现ERROR 就没有问题
$ systemctl restart squid