Original link: https://blog.chenjt.com/archives/ben-bo-ke-ji-ben-wan-cheng-qian-yi
cause
Before, my blog has been built with virtual hosts. The advantage is that the price is extremely low (more than 20 yuan a year, even free), but the disadvantages are also obvious, such as the inability to configure subdomains freely (restricted by the package), only support php, unable to deploy the Halo blog engine that I have always wanted to use, and unable to run Python programs. . . In short, too many restrictions, very unfree. . . Then, on the arrival of Double Eleven, I bought a lightweight application server in Tencent Cloud (Tencent Cloud is really cheap, non-advertising), so far, I can:
- Get a dedicated public IP
- Deploy a non-PHP blogging engine
- Deploy private Git services with Gitea
- Realize intranet penetration
- Develop multiplayer online software and games
- Internet of Things
- QQ robot
- Realize the freedom of the number of subdomains
- Build a mail server
- Automatic quantitative trading
- And more…
Although most of the above have not been realized, in short, the things that can be done are almost unlimited.
Cloud server configuration
2 cores 2G memory, peak bandwidth 30M, is enough for me, if this is not the minimum optional configuration, I will choose 1 core 1G.
I originally wanted to use the image of the pre-installed pagoda panel provided by Tencent Cloud, and then I searched for various loopholes on Zhihu. . . Forget it, decided to start from 0. Windows Server has to pay for it. CentOS is used by many people but has stopped updating (it is still being maintained, but it is not a long-term plan), so I chose Debian, which is stable and has a high degree of open source.
First use cat /proc/cpuinfo
to see the CPU model:
model name : Intel® Xeon® Gold 6146 CPU @ 3.20GHz
I think this configuration is still good, and it can run full for a long time after seeing the official instructions.
service installation
Install and configure in the following order:
- Nginx
- MariaDB (MySQL Compatible Open Source Database)
- PHP
- phpMyAdmin
- OpenJDK
- Halo
At this point, the blog I am using now has been installed. Regarding the migration of articles and comments, I haven’t found a good way to migrate from Typecho to Halo. Seeing that the amount of data is not very large, I don’t write programs, and manually add information such as content and release time to the new database one by one. . . Just cleaned up the spam comments.
I also want to hang up the official websites of several applications I released. Before, I wrote a few static HTML+CSS directly. In order to release more applications in the future, I used Flask and Jinjia2 template engine to write a simple program. After receiving the request, the server rendered and returned, and the source code was placed on GitHub. .
Create a new user, build a Python virtual environment, run the above program with uWSGI, and then use Nginx as a reverse proxy (similar to deploying Halo). See the effect:
After the above is done, the sense of achievement is full. There are still several parts that have not been migrated, and are ready to be moved up after a wave of optimization.
follow-up
After configuring the firewall (in fact, it doesn’t seem to be necessary, Tencent Cloud comes with it) and domain name resolution, the new website is officially opened to the outside world. After running for a while, I pulled the Nginx log and found that every few minutes there are some IP requests for various addresses that do not exist on my server, to list a few:
/owa/auth/logon.aspx
/ipl/app/flash/publicbmw/ball/FigLeaf.js
/getConfig/getArticle.do
…
Some requests will also bring various strange parameters. Probably the server on the public network has the risk of being infiltrated by the network all the time! I can’t see this kind of log on blogs built with virtual hosts before, and I haven’t found it.
This article is reproduced from: https://blog.chenjt.com/archives/ben-bo-ke-ji-ben-wan-cheng-qian-yi
This site is for inclusion only, and the copyright belongs to the original author.