目录

Squid proxy

Notion 上的笔记

教学文章

安装启动

安装命令

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 -x 217.160.61.19:3129 -U "username:passwd" ipinfo.io