java实现代理ip发请求,请参考:https://my.oschina.net/wuminghai/blog/758082 1. 先检查是否安装了squid。 执行命令: which squid 2
java实现代理ip发请求,请参考:https://my.oschina.net/wuminghai/blog/758082
1. 先检查是否安装了squid。
执行命令:
which squid
2.如果没有装则yum安装squid.
yum install squid
3.修改squid.conf参数。
vi /etc/squid/squid.conf
4.修改后的squid.conf(可根据自己需求更改)
acl localnet src 10.0.0.0/8acl localnet src fc00::/7acl localnet src fe80::/10acl SSL_ports port 443acl Safe_ports port 80acl Safe_ports port 443acl CONNECT method CONNECTacl NCACHE method GEThttp_access deny !Safe_portshttp_access deny CONNECT !SSL_portshttp_access deny managerhttp_access allow allhttp_port 8088#指定的端口no_cache deny NCACHEforwarded_for offrequest_header_access Via deny allrequest_header_access X-Forwarded-For deny allrequest_timeout 1 minutesconnect_timeout 1 minutespersistent_request_timeout 1 minuteshalf_closed_clients offacl baidu req_header User-Agent Baiduspiderhttp_access deny baiduvisible_hostname legalishomo.proxy.comcache_mgr [email protected]_open_disk_fds 0
5.创建squid交换目录。
cd /usr/sbin/./squid -z
6.启动squid.
./squid
7.查看端口状态。
netstat -ntl
8.如何停止呢?
./squid -k shutdown
以上则搞定了squid作为代理的配置。已可以使用。