2-14服务器

情人节和电脑过(?)

在服务端安装Hexo实现云端生成

  • 使用npm安装Hexo,将原Hexo文件打包成tar上传服务端解压
  • 进入/home/first,使用命令 hexo g报错:
1
SyntaxError: Unexpected token '.' at wrapSafe (internal/modules/cjs/loader.js:915:16) at Module._compile (internal/modules/cjs/loader.js:963:27) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)...

由于是语法问题,怀疑node版本过低导致,进行版本升级:

1
2
3
4
5
6
#安装版本管理器n
npm install n -g
#升级到最新稳定版
n stable
#切换至最新版
hash -r

再次使用hexo生成没有报错说明猜测成立

  • 修改/etc/apache2/sites-available/000-default.conf下DocumentRoot重定向Apache至Hexo生成的public文件
  • 重启Apache,网页连接发现403错误,权限不足,给777权限仍然无效,于是在/etc/apache2/apache2.conf 中供给权限,将All denied改为All granted:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>

<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>

<Directory /home/first/public>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>


情人节快乐,羊驼


2-14服务器
http://xsyangtuo.top/2-14.html
作者
XSYangtuo
发布于
2024年2月14日
许可协议