部署prerender服务器

Posted 刘镇维

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了部署prerender服务器相关的知识,希望对你有一定的参考价值。

// 安装 git
sudo apt-get install git

sudo apt-get install curl // 请先确认服务器是否安装了curl 如果已经安装跳过即可

// 安装 node
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs

sudo apt-get install -y build-essential

// 下载 prerender
git clone https://github.com/prerender/prerender

cd prerender

// 安装依赖包
npm i --registry https://registry.npm.taobao.org

// 启动
node server.js

// 如果遇到以下错误(后面两行提示的)
2016-12-31T19:57:42.231Z starting worker thread #0
2016-12-31T19:57:42.452Z starting phantom...
2016-12-31T19:57:42.460Z Server running on port 3000
/home/ubuntu/prerender/node_modules/[email protected]/lib/phantom/bin/phantomjs: error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory
(node:10992) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: /home/ubuntu/prerender/node_modules/[email protected]/lib/phantom/bin/phantomjs: error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory

// 修复方案
sudo apt-get install libfontconfig

// 启动成功
[email protected]:~/prerender$ node server.js
2016-12-31T20:00:55.655Z starting worker thread #0
2016-12-31T20:00:55.865Z starting phantom...
2016-12-31T20:00:55.873Z Server running on port 3000
2016-12-31T20:00:56.491Z started phantom








































以上是关于部署prerender服务器的主要内容,如果未能解决你的问题,请参考以下文章

vue-cil 服务端预渲染 prerender-spa-plugin

ini 使用Prerender服务从Javascript页面/应用程序提供预渲染HTML的示例Nginx配置(https://github.com/collect

错误 [prerender-spa-plugin] - 无法预渲染所有路由

Rad Grid prerender事件问题

prerender htaccess for subirectory url

网页加速之Chromium 预载入 Prerendering