wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
/etc/apt/sources.list.d/google.list 内容为
deb http://dl.google.com/linux/chrome/deb/ stable main
sudo apt-get update
sudo apt-get install google-chrome-stable
npm init
npm install --save prerender
const prerender = require('prerender');
const server = prerender({
port: 5001,
chromeLocation: '/usr/bin/google-chrome',
chromeFlags: [
'--headless',
'--disable-gpu',
'--remote-debugging-port=9222',
'--hide-scrollbars'
]
});
server.start();
可以用pm2或者supervisor等watchdog运行这个js文件