Keywordscreate a proxy serverhow to create a proxy servercreate squid proxy server
The reason Recently I used crawlers to crawl some websites and found that sometimes the network is not stable. After switching the network, the results can be crawled.
So there is the idea of building an agent. Usually, the agents provided on the Internet have a short effective time and are very unstable.
In order to have a few stable agents to use, you must either pay or build it yourself. So finally chose to build an agent on
the server.
How to create After looking up some information, I found that Squid is usually used to
build a proxy server on Linux, but after a lot of toss, I found that it is relatively cumbersome to build a proxy server with Squid. So finally chose Shadowsocks + privoxy to realize the simple proxy mode of sock5 proxy to http proxy.
Implementation steps 1. First install the python-pip module, directly execute easy_install pip or directly apt install #The purpose of this step is to install shadowsocks next
2. Install python-shadowsocks module pip install shadowscoks
3. Background process
sudo ssserver -p 8338 -k password -m rc4-md5 --user nobody -d start
The steps in this step are to let shadowsock listen to port 8338 to implement socks5 proxy
Everything is normal, access directly through the socks5 proxy
ps: Parameter setting, please refer to https://pypi.org/project/shadowsocks/ manual
4. Shadowsock can only complete socks5 proxy, if we need to implement http proxy, then we can only convert http protocol and socks5 protocol. Privoxy can achieve this function.
Install privoxy apt-get install privoxy
Edit the configuration file located at /etc/privoxy/config and modify the following parameters
listen-address 0.0.0.0:8118 #Indicates that the external network can also be used as an http proxy through the local IP
forward-socks5 / 127.0.0.1:8338.
Restart or start privoxy
After the startup is complete, you can access it by curl -x http://you.host http://www.baidu.com
Through the above steps, the basic functions of
the proxy server can be realized, the configuration is simple, and the personal use is basically satisfied.
If you have higher requirements for a proxy server, you can use squid to build a proxy server.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.