环境介绍

操作系统:Windows Server 2022 Datacenter
软件版本:nginx 1.24.0,hexo 7.0.0,git 2.42.0.2,node.js 20.9.0


部署

第一次登陆Windows Server 2022 Datacenter,桌面只有回收站图标
右键个性化→主题→桌面图标设置

服务器管理→工具→计算机管理→存储→磁盘管理→划分出20G空间作为D盘

安装git,Chrome,node.js
尝试了在本地启动下面这个项目

1
2
3
4
5
6
7
git clone https://github.com/nijun008/weddingInvitations.git
cd weddingInvitations
npm install
#npm install 报错 The package-lock.json file was created with an old version of npm, npm WARN o
#使用npm i npm@6 -g
#npm -v查看可发现版本号降低,再执行npm install
node app

下载安装Nginx,解压缩nginx-1.24.0.zip,启动Nginx有以下方法:
1、直接双击运行nginx.exe,双击后一个黑色弹窗一闪而过
2、在git bash命令窗口或cmd命令窗口里进入解压目录下,输入”start nginx”
3、检查是否启动成功,打开浏览器访问http://localhost:80
或在cmd命令行输入tasklist /fi “imagename eq nginx.exe”

关闭nginx
如果使用cmd命令窗口启动nginx,关闭cmd窗口是不能结束nginx进程的,可使用两种方法关闭nginx
(1)输入nginx命令 nginx -s stop(快速停止nginx) 或 nginx -s quit(完整有序的停止nginx)
(2)使用taskkill taskkill /f /t /im nginx.exe

迁移Hexo

在D盘创建Hexo文件夹,再其下创建域名文件夹,打开Git Bash在此新建路径下,执行初始化

1
2
3
hexo init
git clone https://github.com/litten/hexo-theme-yilia.git themes/yilia
npm i hexo-generator-json-content --save

修改配置文件config.yml有两个,一个在hexo目录里,一个在主题yilia里

参考https://hexo.io/zh-cn/docs/

拷贝public和source里的文件,重新启动hexo和nginx代理,最后修改阿里云域名解析到新地址

日常维护重启顺序

启动nginx
cmd
D:\nginx-1.24.0
start nginx
nginx -s quit
tasklist /fi “imagename eq nginx.exe”

nginx -t 检查语法

启动hexo
D:\Hexo\xx.xx.cn
git bash
hexo clean && hexo g && hexo s

站内搜索

没有找到内容!