Recently, I've had some free time, so I decided to restore the blog, but it feels too slow on Cloudflare, and the Singapore node is full, so I'm not really keen on using it. Instead, I set up my own reverse proxy node to improve the blog's security and speed.
I have called upon nodes from around the world to use for the reverse proxy of the blog, and the current global average ping is 40ms.
Then I tinkered a bit with the backend, using 3 servers: 2 to run nginx and php, and one to run mysql separately. Although it can easily crash, I still enjoy this kind of tinkering.
How to tell which backend server you are accessing
Check the HTTP header.
[gilicode language=""]
load-balancing: Moeyy-Server_1
[/gilicode]
This indicates that I accessed the first server, while the second one is still idle.
I configured a connection count check to allocate servers, and the server files check for synchronization every 3 seconds.
The most time-consuming tinkering was with load balancing. First, there was a reverse proxy configuration error (which I hadn't noticed), leading to a 502 error. I thought it was a backend issue and made a bunch of changes to the configuration file, but the error persisted. I then tinkered with the reverse proxy server, and the previous changes messed up the load balancing. After fixing the reverse proxy, the load balancing was still down (I got a bit clumsy), but it has now been fixed.
Currently, there's not much left to tinker with; I need to wait until I think of something else to mess with.
Test video 144M (the slow loading is because the reverse proxy has to download resources from the load balancer first, and the load balancer responds a bit slowly; once loaded, there are no issues)
[video width="1920" height="1080" mp4="https://cdn.moeyy.cn/2021/02 / 囍.mp4"\]\[/video\]