更換了一臺阿里雲服務器,從新部署服務。直接上了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