搜索
搜索
天涯的知库
显示页面
过去修订
您的足迹:
本页面只读。您可以查看源文件,但不能更改它。如果您觉得这是系统错误,请联系管理员。
====== Squid proxy ====== [[https://www.notion.so/maiernte/Proxy-517d1dc751dd4eeea8ca98eb812907a0?pvs=4|Notion 上的笔记]] [[https://www.digitalocean.com/community/tutorials/how-to-set-up-squid-proxy-on-ubuntu-20-04|教学文章]] ===== 安装启动 ===== 安装命令 <code> sudo apt update sudo apt install squid </code> 启动/关闭服务 <code> sudo systemctl start squid sudo systemctl enable squid sudo systemctl stop squid # 查看服务情况 sudo systemctl status squid </code> ===== 查询 ===== <color #ff7f27>''%%squid -k parse%%''</color> 查看所有的配置情况 查看端口 <code> ss -tuln | grep squid netstat -tuln | grep squid </code> 如果不行的话, <code shell> # 查看是否在运行 ps -ef | grep squid # 查看所有的端口 sudo netstat -tuln </code> ===== 开通/关闭服务 ===== 外网 HTTP <code> # http_access deny all http_access allow all </code> 端口: 我的服务器开通了3129端口 <code> http_port 3128 </code> 开通 socks 代理服务 <code > http_port 3128 http_port 1080 socks </code> ===== 用户认证 ===== 建立密码文档 <code> sudo apt install apache2-utils sudo htpasswd -c /etc/squid/passwords <your_squid_username> </code> 修改config文件 <file > # # INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS # include /etc/squid/conf.d/* auth_param basic program /usr/lib/squid3/basic_ncsa_auth /etc/squid/passwords auth_param basic realm proxy acl authenticated proxy_auth REQUIRED # Example rule allowing access from your local networks. acl localnet src your_ip_address # Adapt localnet in the ACL section to list your (internal) IP networks # from where browsing should be allowed #http_access allow localnet http_access allow localhost http_access allow authenticated # And finally deny all other access to this proxy http_access deny all </file> ===== 测试服务 ===== 测试方式 * curl 命令 <color #ff7f27>''%%curl -v -x http://217.160.61.19:3129 https://google.com%%''</color> * nc -v <proxy_ip> <proxy_port> <color #ff7f27>''%%nc -v 217.160.61.19 3129%%''</color> (仅仅测试端口是否开通,如果要看内容,使用上一条测试命令) * telnet <proxy_ip> <proxy_port> * ++ 当前服务 | http://tonny:T0dayfine1@217.160.61.19:3129 ++ 查看 ''serverv2ray::/etc/squid'' 第二种方式 <color #ff7f27>''%%curl -x 217.160.61.19:3129 -U "username:passwd" ipinfo.io%%''</color>
it/server/squid.txt
· 最后更改: 2023-08-05 17:25 由
goldentianya
回到顶部