个人站点原部署在GitHub,借助其GitHub-Pages功能实现免费的个人站点部署。后考虑到VPS资源闲置,加上GitHub-Pages貌似不能用https
,就想迁移过去玩玩。
当然,实现方法有很多,我选的是用Nginx + Hexo部署。
环境说明
- 操作系统:Ubuntu 16.04.2 LTS (xenial)
- Nginx version : nginx/1.12.2 built with OpenSSL 1.0.2g
Nginx相关
Nginx安装与配置。
服务搭建
Ubuntu 有对应apt安装包,但需配置。
1.获取Nginx认证签名
1 | wget http://nginx.org/keys/nginx_signing.key |
2.将该key添加到apt中
1 | sudo apt-key add nginx_signing.key |
3.添加nginx软件源
For Ubuntu replace codename with Ubuntu distribution codename, and append the following to the end of the etc/apt/sources.list
file:
1 | deb http://nginx.org/packages/ubuntu/ xenial nginx |
4.更新源并安装nginx
1 | apt-get update |
5.启动nginx
1 | systemctl start nginx |
6.默认nginx配置文件路径
/usr/local/nginx/conf
,/etc/nginx
, or/usr/local/etc/nginx
配置Nginx
编辑 /etc/nginx/conf.d/xx.conf
1 | server { |
重启nginx
1 | systemctl restart nginx |
使nginx开机启动
1 | systemctl enable nginx |
参考
本文完。