安装命令
sudo apt update sudo apt install squid
启动/关闭服务
sudo systemctl start squid sudo systemctl enable squid sudo systemctl stop squid # 查看服务情况 sudo systemctl status squid
squid -k parse
查看所有的配置情况
查看端口
ss -tuln | grep squid netstat -tuln | grep squid
如果不行的话,
# 查看是否在运行 ps -ef | grep squid # 查看所有的端口 sudo netstat -tuln
外网 HTTP
# http_access deny all http_access allow all
端口: 我的服务器开通了3129端口
http_port 3128
开通 socks 代理服务
http_port 3128 http_port 1080 socks
建立密码文档
sudo apt install apache2-utils sudo htpasswd -c /etc/squid/passwords <your_squid_username>
修改config文件
# # 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
测试方式
curl -v -x http://217.160.61.19:3129 https://google.com
nc -v 217.160.61.19 3129
(仅仅测试端口是否开通,如果要看内容,使用上一条测试命令)serverv2ray::/etc/squid
第二种方式 curl -x 217.160.61.19:3129 -U "username:passwd" ipinfo.io