IPIPGO ip proxy webserver set proxy ip: Nginx/Apache server proxy configuration program

webserver set proxy ip: Nginx/Apache server proxy configuration program

Teach you to use Nginx/Apache to build a proxy server to engage in web development should have encountered this situation: their servers to docking third-party interfaces, the results of other people's interfaces to limit the frequency of access. This time on the server to hang a proxy IP can be a perfect solution, today we will nag how ...

webserver set proxy ip: Nginx/Apache server proxy configuration program

Teach you how to use Nginx/Apache to build proxy servers

The old iron engaged in web development should have encountered this situation: their servers to docking third-party interfaces, the results of other people's interfaces to limit the frequency of access. This time on the server to hang a proxy IP can be a perfect solution, today we will nag how to use the most common Nginx and Apache the whole job.

Why do I need to hang a proxy on my server?

To give a real scenario: you have a crawler program running on AliCloud, the target site to AliCloud's IP segment all blacked out. At this time through the server forwarding request, with a proxy IP access to the target site, just like the Monkey King seventy-two changes, easy to bypass the restrictions.

I'd like to introduce you to our family.ipipgo proxy serviceThe IP resources of more than 200 countries in the world support HTTP/HTTPS/Socks5 protocols, and it is easy for thieves to dock.

Nginx proxy configuration in practice

Open the nginx.conf configuration file and add these lines to the server block:


location /api {
    proxy_pass http://目标网站域名; proxy_set_header Host $host; proxy_set_header
    proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header
    proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for

     Here comes the kicker! Set the proxy IP here
    resolver 8.8.8.8 valid=30s;
    set $proxy_server "http://用户名:密码@gateway.ipipgo.com:端口";
    proxy_pass $proxy_server;
}

Be careful to putuser IDrespond in singingcryptographicReplace it with the account information you registered with ipipgo and fill in the port number according to the type of package you purchased. Remember tonginx -s reloadRestart the service.

Tips for setting up an Apache proxy

Find the httpd.conf file and enable both modules:


LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

Then add it in the VirtualHost configuration segment:


ProxyRequests Off
ProxyPass "/api" "http://目标网站域名"
ProxyPassReverse "/api" "http://目标网站域名"

 Proxy IP Configuration Key Steps
ProxyRemote "http://目标网站域名" "http://用户名:密码@gateway.ipipgo.com:端口"

Here's a pitfall to be aware of: Apache'sProxyRemoteThe command is not very friendly to HTTPS support, it is recommended to directly use the Socks5 protocol provided by ipipgo is more secure.

Proxy IP Selection Guide

Here's a ipipgo package comparison table for the guys to pick the right one according to their business needs:

Package Type Applicable Scenarios prices
Dynamic residential (standard) Data collection, price monitoring 7.67 Yuan/GB/month
Dynamic Residential (Business) Ad verification, social management 9.47 Yuan/GB/month
Static homes Long-term fixed IP requirements 35RMB/IP/month

Frequently Asked Questions QA

Q: What should I do if my website slows down after proxy setting?
A: Check the geographic location of the proxy server, such as doing business in Europe and the United States to choose the local IP, with ipipgo client can be real-time speed selection node.

Q: How do I verify if the agent is in effect?
A: Executed on the servercurl -x http://代理IP:端口 http://ipinfo.io/ipto see if the returned IP is a proxy IP.

Q: What if I need more than one country IP at the same time?
A: directly find ipipgo customer service to customize the program, their cross-border line supports automatic switching of country nodes, more cost-effective than buying multiple IPs individually.

Tips for avoiding pitfalls

1. When doing HTTPS proxying, remember to add the following to the Nginx configurationproxy_ssl_server_name on.Otherwise, a certificate error will be reported.
2. encountered 403 forbidden error, may be the target site to identify the characteristics of the proxy, change to ipipgo exclusive static IP can be solved!
3. When the traffic consumption is abnormal, go to the background of ipipgo to check the real-time usage, support hourly granularity view, to avoid excessive deduction.

One final point:Don't use free proxies for cheapBefore we had a client who used a wild proxy, the database was implanted with mining scripts. With ipipgo this kind of regular service provider, there is a professional technical team to do IP cleaning, the security coefficient is several grades higher.

This article was originally published or organized by ipipgo.https://www.ipipgo.com/en-us/ipdaili/43782.html

business scenario

Discover more professional services solutions

💡 Click on the button for more details on specialized services

New 10W+ U.S. Dynamic IPs Year-End Sale

Professional foreign proxy ip service provider-IPIPGO

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact Us

13260757327

Online Inquiry. QQ chat

E-mail: hai.liu@xiaoxitech.com

Working hours: Monday to Friday, 9:30-18:30, holidays off
Follow WeChat
Follow us on WeChat

Follow us on WeChat

Back to top
en_USEnglish