squid代理配置

  1. 安装Squid
    yum -y update
    yum -y install epel-release
    yum -y update
    yum clean all

    yum -y install squid
    systemctl start squid
    systemctl enable squid   # 开机自启动
    systemctl status squid   # 查看服务状态
    squid -v   # 查看版本

2.允许不同用户使用不同的出口IP

    # 安装生成用户密码验证文件的软件
    yum -y install httpd-tools
    touch /etc/squid/passwd && chown squid /etc/squid/passwd
    htpasswd /etc/squid/passwd pxuser
    
    # 配置用户认证信息
        # 选择的认证方式为basic,认证程序路径和密码文件路径。
        auth_param basic program /usr/lib64/squid/basic_ncsa_auth /etc/squid/passwd 
        # 认证程序的进程数
        auth_param basic children 10
        # 认证有效时间
        auth_param basic credentialsttl 4 hours
        # 不区分大小写
        auth_param basic casesensitive off


        # 配置不同用户的出口IP
        acl acl_user1 proxy_auth -i user1
        http_access allow acl_user1
        tcp_outgoing_address 10.10.12.1 acl_user1

        acl acl_user2 proxy_auth -i user2
        http_access allow acl_user2
        tcp_outgoing_address 10.10.12.1 acl_user2

3.设置代理高匿

    via off
    forwarded_for off  /  forwarded_for delete
    follow_x_forwarded_for deny all


    request_header_access From deny all
    request_header_access Server deny all
    request_header_access WWW-Authenticate deny all
    request_header_access Link deny all
    request_header_access Cache-Control deny all
    request_header_access Proxy-Connection deny all
    request_header_access X-Cache deny all
    request_header_access X-Cache-Lookup deny all
    request_header_access Via deny all
    request_header_access X-Forwarded-For deny all
    request_header_access Pragma deny all
    request_header_access Keep-Alive deny all
  1. 禁用缓存
    cache deny all
    With Squid-2.7, Squid-3.1 and later you can also remove all 'cache_dir' options from your squid.conf to avoid having a cache directory.

你可能感兴趣的:(squid代理配置)