Baota Panel uses Nginx for reverse proxy, which improves website access speed and enhances protection; reverse proxy Cloudflare CDN settings

Baota Panel uses Nginx for reverse proxy, which improves website access speed and enhances protection; reverse proxy Cloudflare CDN settings

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
1.1.1.1 www.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

<<:  NecoVM: 58 yuan/month/256MB memory/8GB SSD space/100GB traffic/50Mbps-100Mbps port/OpenVZ/Shenzhen-Hong Kong IPLC/Shanghai-Hong Kong IPLC

>>:  BeerVM: 60 yuan/month/3 cores/4GB memory/100GB space/10TB traffic/100Mbps port/NAT/KVM/Henan Mobile

Recommend

【Black Friday, Cyber ​​Monday】Collection of great deals

It is estimated that many people did not pay atte...

Free .bit Domain

Registration address: https://getdotbit.com/ Free...

CrownCloud: $15/year/1 IPv4/256MB memory/4GB space/1TB traffic/KVM

As introduced before, the same model now has doub...

White Sands Hosting: $14.49/year/128MB RAM/25GB storage/1000GB bandwidth/OpenVZ

White Sands Hosting, an American hosting provider...

Cochin Web Hosting: $30/month/2GB RAM/30GB SSD/KVM/Singapore/Hong Kong

Cochin Web Hosting, an Indian hosting provider, p...

Introduction to PowWeb Hosting

Latest offer: $3.88 per month, details at http://...

NAMECHEAP offers $5.99 domain name discounts

This discount code should have been released at t...

PieLayer: $20/year/1GB memory/100GB space/800GB traffic/OpenVZ/New York

PieLayer, introduced 3 times, this time there is ...