In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Summary: by building a naked git warehouse on the CVM, and then using nginx as the web server, you can easily deploy the Hexo blog to the CVM through git.
This is a sad story.
My blog KiwenLau was previously deployed on Coding Pages, which is pretty good, and you can enable HTTPS with one click. As a person who likes to toss around, I suddenly intend to use CDN to speed up my visit. However, domestic CDN services require websites to put on record. I specially emailed the customer service of Coding, and it seems that they are not going to support filing in the near future, so I have to consider setting up a cloud host to play with.
Later, Coding Pages suddenly added a jump page, which means that if you visit my blog, the Coding ad page will pop up for 5 seconds. Buy a Coding annual fee of 199 members can be removed, but also not expensive, after all, occupy other people's resources. However, I am still thinking about using CDN after filing.
So I did a survey of the prices of various cloud services and found that one core and one gigabyte of CVMs are about 600 kilowatts a year, which is much more expensive than Coding members. However, Tencent Cloud has recently been engaged in a purchasing festival. The CVM with 1 core and 1G is only 238 a year, so I bought it decisively!
However, the matter of filing seems to take a long time. Ten thousand words are omitted here.
0. Preparatory work
The operating system of my CVM is Ubuntu Server 16.04.1 LTS 64-bit. Assuming that its IP address is 152.92.13.78 (I certainly won't tell you the real IP), the first step you need to do is to configure the SSH public key login so that Hexo does not need to enter a password when deploying the blog through git.
# SSH public key login will not require the entry of password ssh root@152.92.13.78
To save trouble, I will use root users directly, which is not in compliance with the security specification. However, on the one hand, I only want to deploy my blog, so I don't worry about doing bad things. On the other hand, I have also taken necessary security precautions, such as configuring Tencent Cloud security group, forbidding login of SSH password and configuring UFW firewall.
This blog refers to the deployment of HEXO to VPS using GIT HOOKS, and the original text is illustrated. I made some optimizations, such as using root users, simplifying nginx configuration files, simplifying post-receive scripts, and briefly introducing how it works.
1. Install git and nginxapt-get updateapt-get install git-core nginx2. Configure the Nginx/var/www/blog directory to place the generated static file mkdir / var/www/blog write the nginx configuration file vim / etc/nginx/conf.d/blog.conf
As my record is not ready, I can't use port 80, so I use port 8080 to deploy the blog for the time being.
Server {listen 8080; root / var/www/blog;} restart nginx
The init system of ubuntu 16.04 has been replaced with systemd, so use the systemctl command to restart nginx.
Systemctl restart nginx3. Configure Git Hooks to create a Git naked warehouse
Blog.git is a remote Git repository, and blog static files generated locally by Hexo can be synchronized with it through push.
Mkdir ~ / blog.git & & cd ~ / blog.gitgit init-- bare configuration Hooks script
The post-receive script will be executed when the blog.git repository receives the push.
Vim. / hooks/post-receive
The script is very simple, delete the original / var/www/blog directory, and then clone the new blog static files from the blog.git repository.
#! / bin/bashrm-rf / var/www/bloggit clone / root/blog.git / var/www/blog
Give post-receive script execution permission
Chmod + x. / hooks/post-receive4. Deploy Hexo blog modify _ config.ymldeploy: type: git repo: root@152.92.13.78:blog.git deployment blog
Mr. hexo creates a new blog static file and then syncs it to the cloud host's blog.git repository via git.
Hexo d
You can then access the blog through http://152.92.13.78:8080/.
After filing, change the ngnix port to 80, set server_name as the domain name, and then modify the DNS to resolve to the CVM.
Reference link: deploy HEXO to VPS with GIT HOOKS about Fundebug
Fundebug specializes in real-time BUG monitoring of JavaScript, WeChat Mini Programs, Wechat, Mini Game, Mini Program, React Native, Node.js and Java. Since the official launch of Singles' Day in 2016, Fundebug has handled a total of 700 million + errors, which has been recognized by many well-known users, such as Google, 360,360, Kingsoft, people's Network and so on. Welcome to try it for free!
Copyright notice
Please indicate the author's Fundebug and the address of this article when reprinting:
Https://blog.fundebug.com/2017/05/18/deploy-hexo-on-cloud/
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.