1. Assume that you have 2 VPSs, one is Linode Japan, IP 1.1.1.1 (slow domestic direct access speed), and the other is Hong Kong CN2, IP 2.2.2.2 (fast domestic access speed) The website is built on Linode Japan VPS and the domain name is xxxxx.com. Install Baota Panel on Hong Kong CN2 VPS and install Nginx. 2. At your website's domain name resolution, set the domain name A record to the IP address of Hong Kong CN2 VPS: 2.2.2.2 3. Set up the Hong Kong CN2 VPS Pagoda panel page: Create a new website xxxxx.com, SSL certificate, set the reverse proxy to xxxxx.com, and enable cache Modify the /etc/hosts file and add the following information at the end of the file: 1.1.1.1 xxxxx.com 4. The default file cache location is /www/server/nginx/proxy_cache_dir The anti-proxy configuration file is /www/server/nginx/conf/proxy.conf 5. In this way, when others visit your website, they will use the speed of Hong Kong CN2, which is much faster than directly accessing Linode Japan. It is recommended that the reverse generation be performed on areas with similar locations. In addition, there can be multiple front-end nodes with the same settings. This article mainly refers to: https://www.openos.org/post/107/ 6. Baota panel uses Nginx to reverse Cloudflare CDN settings Use the same settings as above, and then modify the website configuration file and replace it with the following code: (mainly the content of #PROXY-START —— #PROXY-END) a. Use your own domain name to reverse the domain name in Cloudflare for acceleration (replace your domain name in it) #PROXY-START/ location ~* \.(php|jsp|cgi|asp|aspx)$ { proxy_pass https://your domain name; proxy_set_header Host your domain name; #Pass the visitor IP to the backend proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REMOTE-HOST $remote_addr; #Pass the visitor IP to the backend proxy_ssl_name your domain name; proxy_ssl_server_name on; } location / { proxy_pass https://your domain name; proxy_set_header Host your domain name; #Pass the visitor IP to the backend proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REMOTE-HOST $remote_addr; #Pass the visitor IP to the backend proxy_ssl_name your domain name; proxy_ssl_server_name on; #Cache settings add_header X-Cache $upstream_cache_status; #Set Nginx Cache proxy_ignore_headers Set-Cookie Cache-Control expires; proxy_cache cache_one; proxy_cache_key $host$uri$is_args$args; proxy_cache_valid 200 304 301 302 120m; expires 12h; } #PROXY-END/ b. Use your own domain name to represent someone else's domain name on Cloudflare #PROXY-START/ location ~* \.(php|jsp|cgi|asp|aspx)$ { proxy_pass https://the other party's domain name; proxy_set_header Host the other party's domain name; #Pass the visitor IP to the backend proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REMOTE-HOST $remote_addr; #Pass the visitor IP to the backend proxy_ssl_name is the domain name of the other party; proxy_ssl_server_name on; } location / { proxy_pass https://the other party's domain name; proxy_set_header Host the other party's domain name; #Pass the visitor IP to the backend proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REMOTE-HOST $remote_addr; #Pass the visitor IP to the backend proxy_ssl_name is the domain name of the other party; proxy_ssl_server_name on; #Cache settings add_header X-Cache $upstream_cache_status; #Set Nginx Cache proxy_ignore_headers Set-Cookie Cache-Control expires; proxy_cache cache_one; proxy_cache_key $host$uri$is_args$args; proxy_cache_valid 200 304 301 302 120m; expires 12h; } #PROXY-END/ Reposted from: https://hostloc.com/thread-643951-5-1.html |
Tencent Cloud has upgraded its lightweight cloud ...
It is estimated that many people did not pay atte...
ServerAstra, a Hungarian hosting provider, mainly...
OneTechCloud was established in 2019 and mainly p...
Registration address: https://getdotbit.com/ Free...
Qinglian Network is a newly established hosting p...
As introduced before, the same model now has doub...
White Sands Hosting, an American hosting provider...
Cochin Web Hosting, an Indian hosting provider, p...
Latest offer: $3.88 per month, details at http://...
NexusBytes, an American merchant, was founded in ...
This discount code should have been released at t...
PieLayer, introduced 3 times, this time there is ...
DogYun, a Chinese merchant, mainly provides KVM V...
Ethernetserver, a British hosting company, is a f...