deploy hexo with nginx on centos
deploy hexo by nginx on centos
- create some dirs and enter pkgs dir
1
| mkdir /home/packages && cd /home/packages
|
- download npm compiled source code and unzip it
1
2
| wget https://nodejs.org/dist/v11.9.0/node-v11.9.0-linux-x64.tar.xz
tar -xvf node-v11.9.0-linux-x64.tar.xz -C /usr/share/
|
1
2
3
| mv /usr/share/node-v11.9.0-linux-x64 /usr/share/nodejs
ln -s /usr/share/nodejs/bin/node /usr/local/bin/
ln -s /usr/share/nodejs/bin/npm /usr/local/bin/
|
1
2
| npm install -g hexo-cli
ln -s /usr/share/nodejs/bin/hexo /usr/local/bin/
|
install nginx
1
| vi /etc/yum.repos.d/my.repo
|
1
2
3
4
5
6
7
8
9
10
11
12
13
| [nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
|
- install nginx and start it
1
2
| yum install -y nginx
systemctl start nginx && systemctl enable nginx
|
1
| mkdir /home/website && cd /home/website && hexo init && hexo g
|
1
| vi /etc/nginx/conf.d/default.conf
|
1
2
3
4
| location / {
root /home/website/public;
index index.html index.htm;
}
|
1
| systemctl restart nginx
|
Now, you can access your blog by your IP address.