目录
前言
闲来无事想把部署在gitpages上的博客转到服务器上,访问速度相对快一点。大致方法就是,本地hexo文件夹连接到服务器git文件夹,创建一个钩子,当每次推送时自动将文件同步到网页根目录中。
基础环境
服务器:git,nginx
本地:node.js, nexo, git,
本地hexo g && hexo s可以预览成功
部署
创建git用户
adduser git
修改sudoers文件(给git加权限)
//修改权限
chmod 740 /etc/sudoers
// 编辑sudoers文件
vim /etc/sudoers
找到User privilege specification 设置root权限部分
在root下添加 以下代码 权限跟root一样就行(i 开始编辑)
git ALL=(ALL:ALL) ALL
保存并退出
esc 退出编辑
:wq 保存退出
改回权限
chmod 400 /etc/sudoers
修改sshd_config文件
输入以下代码开始编辑
vim /etc/ssh/sshd_config
在sshd_config文件中设置以下几项(注意有些以#开头的是被注释了的,需要打开注释)
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFi