请帮忙。我花了 2 周时间尝试让一直用在另一台 128 ips 服务器上的代理脚本在新的 253 ips 服务器上运行。
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl localnet src fc00::/7 # RFC 4193 local private network range
acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
# http_access deny !Safe_ports
# http_access deny CONNECT !SSL_ports
# http_access deny all
http_access allow localnet
http_access allow localhost
# hierarchy_stoplist cgi-bin ?
# Uncomment and adjust the following to add a disk cache directory.
cache_dir ufs /var/spool/squid 300 16 256
coredump_dir /var/spool/squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 0 20% 4320
auth_param basic program /usr/lib/squid3/basic_ncsa_auth
auth_param basic children 5
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 2 hours
acl ncsa_auth proxy_auth REQUIRED
http_access allow ncsa_auth
# http_port 3000
http_port 164.163.XXX.2:3000 intercept name=3000
http_port 164.163.XXX.3:3000 intercept name=3001
acl ip1 myportname 3000
acl ip2 myportname 3001
tcp_outgoing_address 164.163.XXX.2 ip1
tcp_outgoing_address 164.163.XXX.3 ip2
forwarded_for off
#request_header_access Allow allow all
#request_header_access Authorization allow all
#request_header_access WWW-Authenticate allow all
#request_header_access Proxy-Authorization allow all
#request_header_access Proxy-Authenticate allow all
#request_header_access Cache-Control allow all
#request_header_access Content-Encoding allow all
#request_header_access Content-Length allow all
#request_header_access Content-Type allow all
#request_header_access Date allow all
#request_header_access Expires allow all
#request_header_access Host allow all
#request_header_access If-Modified-Since allow all
#request_header_access Last-Modified allow all
#request_header_access Location allow all
#request_header_access Pragma allow all
#request_header_access Accept allow all
#request_header_access Accept-Charset allow all
#request_header_access Accept-Encoding allow all
#request_header_access Accept-Language allow all
#request_header_access Content-Language allow all
#request_header_access Mime-Version allow all
#request_header_access Retry-After allow all
#request_header_access Title allow all
#request_header_access Connection allow all
#request_header_access Proxy-Connection allow all
#request_header_access User-Agent allow all
#request_header_access Cookie allow all
#request_header_access All deny all
一周后,我得到了在 squid 3.1 上运行的 128 个代理,但被告知要使用以下配置选项编译 squid 3.5,以便 253 个代理在同一服务器上运行:
配置选项:'--build=x86_64-redhat-linux-gnu''--host=x86_64-redhat-linux-gnu''--target=x86_64-redhat-linux-gnu''--program-prefix=''--prefix=/usr''--exec-prefix=/usr''--bindir=/usr/bin''--sbindir=/usr/sbin''--sysconfdir=/etc''--datadir=/usr/share''--includedir=/usr/include''--libdir=/usr/lib64''--libexecdir=/usr/libexec''--sharedstatedir=/var/lib''--mandir=/usr/share/man''--infodir=/usr/share/info' '--verbose' '--exec_prefix=/usr' '--libexecdir=/usr/lib64/squid' '--localstatedir=/var' '--datadir=/usr/share/squid' '--sysconfdir=/etc/squid' '--with-logdir=$(localstatedir)/log/squid' '--with-pidfile=$(localstatedir)/run/squid.pid' '--disable-dependency-tracking' '--enable-follow-x-forwarded-for' '--enable-auth' '--enable-auth-basic=DB,LDAP,NCSA,NIS,PAM,POP3,RADIUS,SASL,SMB,getpwnam' '--enable-auth-ntlm=smb_lm,fake' '--启用-auth-digest=file,LDAP' '--启用-auth-negotiate=kerberos,wrapper' '--启用-external-acl-helpers=wbinfo_group,kerberos_ldap_group' '--启用-cache-digests' '--启用-cachemgr-hostname=localhost' '--启用-delay-pools' '--启用-epoll' '--启用-icap-client' '--启用-ident-lookups' '--启用-linux-netfilter' '--启用-removal-policies=heap,lru' '--启用-snmp' '--启用-storeio=aufs,diskd,ufs,rock' '--启用-wccpv2' '--启用-esi' '--启用-ssl-crtd' '--启用-icmp' '--with-aio' '--with-default-user=squid' '--with-filedescriptors=16384' '--with-dl' '--with-openssl' '--with-pthreads' '--with-included-ltdl' '--disable-arch-native' '--without-nettle' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'target_alias=x86_64-redhat-linux-gnu' 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' 'CXXFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC' 'PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig' '--enable-ltdl-convenience' 'CXXFLAGS=-DMAXTCPLISTENPORTS=256'
有人可以帮帮我吗,因为我不知道代理脚本到底在做什么:
http_port 164.163.XXX.2:3000 拦截名称=3000 http_port 164.163.XXX.3:3000 拦截名称=3001
acl ip1 我的端口名称 3000 acl ip2 我的端口名称 3001
tcp_outgoing_address 164.163.XXX.2 ip1 tcp_outgoing_address 164.163.XXX.3 ip2
现在,在 squid 3.5 上我无法让它们中的任何一个继续工作。
答案1
添加
acl localnet src 164.163.0.0/16
使用其他 acl localnet 行。您不允许这些 ip 使用 squid。
当我阅读以下指南时:https://askubuntu.com/questions/680246/proxy-server-multiple-ips
我懂了:
http_port xx.xxx.xxx.111:3128 name=3128
http_port xx.xxx.xxx.112:3129 name=3129
...
然后对于每个端口:
acl tasty3128 myportname 3128 src yy.yyy.yyy.0/24
http_access allow tasty3128
tcp_outgoing_address xx.xxx.xxx.111 tasty3128
acl tasty3129 myportname 3129 src yy.yyy.yyy.0/24
http_access allow tasty3129
tcp_outgoing_address xx.xxx.xxx.112 tasty3129
在您的配置中,我没有看到“http_access allow ...”。