假设hexo已经搭建完成,并且hexo server
可以正常运行
nginx下站点配置文件1234567891011121314151617upstream node_app {server 127.0.0.1:4000;} server {listen 80;server_name blog.wangchunjian.win;location / { proxy_pass http://node_app;}location ~* .(gif|jpg|jpeg|png|css|js|ico)$ { root /www/web/nodejs/test/public; expires 1h;}}
使用nohup
后台运行hexo
1234cd /www/web/nodejs/testnohup hexo server & //如果不想输出任何信息nohup hexo server >/dev/null 2>&1 &
必须使用
exit
退出,不然nohup的session会中断
安装hexo_admin
后会发现无法加载css 和 js ,但是访问4000端口是可以加载的,所以手动把缺的文件拷贝了一份到 public/admin文件夹下。源文件在/www/web/nodejs/test/node_modules/hexo-admin/www
下。
使用nginx加载静态资源会快一些,还可以设置缓存时间。。。