Proxy server

Squid

安装

yum install squid

配置 /etc/squid/squid.conf

# 允许所有主机访问,添加如下
acl all src all
http_access allow all

# 隐藏真实IP,添加如下
forwarded_for delete
or
forwarded_for off

启动,退出

service squid start
service squid stop
service squid restart

测试

curl -x http://host:port -L http://www.baidu.com

Authentication

  • INSTALL httpd-tools

    yum -y install httpd-tools
    
  • CREATE A USERNAME/PASSWORD

    touch /etc/squid/passwd && chown squid /etc/squid/passwd
    htpasswd /etc/squid/passwd pxuser
    
  • CONFIG

    注意配置添加的位置和顺序
    #
    # INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
    #
    auth_param basic program /usr/lib64/squid/ncsa_auth /etc/squid/passwd
    auth_param basic children 5
    auth_param basic realm Squid proxy-caching web server
    auth_param basic credentialsttl 2 hours
    auth_param basic casesensitive off
    
    acl zcb proxy_auth REQUIRED
    http_access allow zcb
    
  • TEST

    curl -x http://host:port --proxy-user username:pass -L http://www.baidu.com
    

Tinyproxy

Privoxy

Shadowsocks

server 安装

pip install shadowsocks

配置

# 新建文件 /etc/shadowsocks.json

{
    "server":"0.0.0.0",
    "server_port":8888,
    "local_address": "127.0.0.1",
    "local_port":1080,
    "password":"mypassword",
    "timeout":300,
    "method":"aes-256-cfb",
    "fast_open": false
}

多用户配置,配置多个端口

"port_password":
{
    "20000": "password0",
    "20001": "password1",
    "20002": "password2",
}
"_comment":
{
    "20000": "userA",
    "20001": "userB",
    "20002": "userC",
}

运行,退出

ssserver -c /etc/shadowsocks.json -d start
ssserver -c /etc/shadowsocks.json -d stop