阿里云使用宝塔面板部署 Hexo 博客

It has been 541 days since the last update, the content of the article may be outdated.

宝塔系统依托于 Centos 开发,所以我们服务器系统选择 Centos7+

yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh

安装完成后,登录宝塔,首次登录会提示我们安装环境,我们勾选

即可。

之后,我们在 home 文件夹下新建 githexo 这两个文件夹

随后,我们登录我们的服务器,一次执行

cd .. cd home cd git git init --bare blog.git

接着,在目录 /home/git/blog.git/hooks 下新建文件 post-receive,写入一下代码

git --work-tree=/home/hexo --git-dir=/home/git/blog.git checkout -f

post-receive 权限

chmod +x /home/git/blog.git/hooks/post-receive

宝塔面板默认的

配置文件在根目录 ->www->serve->nginx->conf 下,找到

,编辑它

重启 nginx 服务

service nginx restart

修改

中的配置

deploy: type: git repo: user@ip:/home/git/blog

这个时候配置差不多就好了,

部署后就可以访问博客了

接下来在宝塔面板里添加网站

之后在阿里云将域名解析到服务器 ip 即可

在阿里云中申请个证书,将内容填入其中即可

原文链接:https://blog.csdn.net/qq_30141543/article/details/125576154

© 版权声明
THE END
喜欢就支持一下吧
点赞11 分享