For a little over a year, I’ve been using Alibaba Cloud (阿里云) to host my web server. It has done an excellent job. The user interface is well-designed, and the server machine never upset me. With all that being said, I’ve decided to switch to Tencent Cloud’s Lightweight Server (腾讯云) for the next three years, the primary reason being the price.
It is REALLY cheap.
A two-core four-gigabyte server with 60GB of SSD, plus a free IPv4 address with 6M bandwidth, only costs about 270 Chinese Yuan for three years. That’s less than 45 US dollars. The normal price for this kind of setup should be around 3000 Yuan, which is more than ten times higher. I got this price using the new member discount. Nowadays almost every cloud server seller offers huge discounts to their first-time buyers. That’s also how I obtained my server from Alibaba Cloud last year, which cost me about 280 Yuan for a year of use. The price Alibaba offered was quite attractive then, but it is far less so now, compared to that from Tencent Cloud, its biggest competitor. The Tencent Cloud deal is almost like a steal.
People say Alibaba Cloud is still the best cloud server provider in China today. I agree on the fact that Alibaba Cloud is great. However, from my early experience of using Tencent Cloud this week, I feel that Tencent Cloud is not bad, either. It is fast and stable. I’ve had bad experience before, with a Huawei Cloud server, my first cloud server in my life. It was a one-core one-gigabyte ARM server that suffered very badly from its architecture compatibility problems and memory shortage problems.
My server hosting this website is basically a LAMP combo with WordPress and PhpMyAdmin installed. LAMP stands for Linux, Apache web server, Mysql database, and PHP. Though being a fairly experienced computer engineer, I ran into some small but irritating problems when reinstalling all these softwares mentioned above and setting up the new environment. I’d like to list some bullet points here down below in case I may have to do this again a few years later.
Start with Linux. I used CentOS 8 on last Alibaba server. Because CentOS 8 is no longer supported by its developers, I’m switching to Tencent OS 3 on the new Tencent server. As far as I know, the latter OS is a modified version of the former one and has the same programming interface. It is supported by the Tencent Cloud tech group. I hope it can potentially perform better on their own server than other OS because it has the native advantage. As a side note, they also have a Tencent OS 2 version which resembles CentOS 7. To get updates for the OS in the future, we just need to use the yum update command.
After the Apache web server was installed, we’ll need to use dnf to install mod_ssl module, otherwise we won’t be able to enable https.
Use yum or dnf to install mysql-server to the system, not mysql. This small detail needs special attention. Then we run mysql_secure_installation setup program and we’re done with mysql.
The PHP version that WordPress requires is 7.4 or above, while the default version yum and dnf provide is 7.2. We need to use dnf module command to change the version and then download it. After installation, don’t forget to use systemctl command to turn on the php-fpm service, otherwise PhpMyAdmin will simply not work.
Nothing to say about PhpMyAdmin.
I customized WordPress by changing some of its code. There are four modifications in total. The first one is to solve the No Read More problem. We just need to download the Read More Excerpt Link plugin and rewrite some of its code, and we don’t need to touch any other file for this problem. The plugin is actually just a single php file, and its excerpt and read-more logic will overwrite that of the theme. That’s why we don’t need to modify the theme. While Inspiro doesn’t provide read-more button for posts that are manually excerpted, the plugin does. (Chinese articles can only be manually excerpted.) However, If we don’t modify the plugin, it will use a plain text read-more link, which is ugly and clearly not what we want. We need to find out how Inspiro renders the read-more button and copy that part of code from Inspiro to our plugin. The code can be easily found by searching the theme code for the css class name of the button. The file’s name is common-fucntion.php.
Next we replace the footer (site-info) with our own one. The only file that needs modification is site-info.php located in template-parts/footer under the Inspiro folder. The third modification is that we don’t want the redundant No Comment information displayed under blog header in latest posts in main page, given that we are not allowing comments for now.
The fourth one pertains to the avatar. By default, wordpress uses Gravatar, which is an avatar website where people upload their photos and make avatars. Then web applications like wordpress can get user’s avatar from Gravatar by their email address. In short, we have to store our picture on Gravatar and use it in wordpress. That sounds fine. It should work well if everything is normal, which is unfortunately not the case in China. The problem is blog viewers in China can’t get access to Gravatar. When they open a blog, they download almost everything from my server, which is totally legal in China, and download my avatar from Gravatar, which is not so welcome in this country for who knows what reason. The result would be that the avatar is missing from the page, leaving a broken picture icon. The solution for this is quite easy. We just need to add a plugin named Simple Local Avatar. Besides, the default size of the avatar in inspiro is a little too small. We can change its size in its source files. Specifically, it’s a function named get_avatar() in template-tags.php file.
It is worth mentioning that besides all plugins Inspiro requires, there are only two additional plugins we must install, and they are the Read More Excerpt Link and Simple Local Avatar. Others like the one customizes term orders and the one hides posts are completely optional and do not have notable effect.
Edit: The Big File uploads plugin might be useful.