banner
moeyy

moeyy

一条有远大理想的咸鱼。
github
mastodon
email

Daily tinkering with the blog

Recently, I had some free time, so I decided to update my blog. However, I felt that it was too slow when hosted on Cloudflare, and the Singapore node I used before was also full, so I didn't want to use it anymore. Instead, I decided to set up a reverse proxy node myself to improve the security and speed of my blog.

I used nodes from around the world to reverse proxy my blog, and the average global ping is now 40ms.

image

Then I made some changes to the backend. I used three servers for the backend, with two running Nginx and PHP, and one dedicated to running MySQL. Although it's prone to explosions, I still enjoy tinkering like this.

How to determine which backend server you are accessing

Check the HTTP headers.

[gilicode language=""]

load-balancing: Moeyy-Server_1

[/gilicode]

This indicates that I am accessing the first server, while the second server is still idle.

I configured connection count-based server allocation, and the server files are synchronized every 3 seconds.

The most time-consuming part was load balancing. First, I had a reverse proxy configuration error (which I hadn't noticed), resulting in a 502 error. I thought it was a backend issue, so I made a lot of changes to the configuration files, but the error persisted. Then I went to tinker with the reverse proxy server, and as a result, my load balancing got messed up due to the previous changes. After fixing the reverse proxy, the load balancing was still broken (my bad), but now it's been fixed.

Currently, there's nothing else I can tinker with. I'll have to wait until I come up with something.

Test video 144M (slow loading is due to the reverse proxy needing to download resources from the load balancer first, and the load balancer's response is a bit slow. Once it's loaded, there won't be any issues.)

[video width="1920" height="1080" mp4="https://cdn.moeyy.cn/2021/02 / 囍.mp4"\]\[/video\]

image

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.