The Legend of Heroes: Sora No KISEKI
This is the End, as well as the Beginning ─
MENU

Centos7下基于宝塔面板的NodeBB部署教程

2020-02-04 上午 12:06

前言

今天心血来潮,想着以后可能会需要一个论坛和小伙伴们交了,故今天折腾了一下,尝试了NodeBB和Flarum。
Flarum我半个小时就搭好了,这NodeBB坑挺多的,所以就写个文章记一下坑,怕自己忘了。

NodeBB简介

Github:https://github.com/NodeBB/NodeBB

NodeBB是Design Create Play开发的一款使用Node.js构建的论坛系统,使用redis或mongoDB数据库,采用web socket技术实现。支持响应式布局,兼容IE8,将论坛的体验带向一个新的高度。

国外的论坛系统都相当纯粹,并不会像Discuz、phpwind那样提供各种建站所需模块。

开始折腾

直接上SSH

yum -y update

yum -y install epel-release

yum -y groupinstall "Development Tools"
#这里不用装Redis和npm因为可以直接在宝塔上装
yum -y install git ImageMagick

nvm list-remote
#直接装最新的,v12也行
nvm install v13.7.0
#使用cnpm代替npm
npm install -g cnpm
#下载
cd /path/to/nodebb/install/location
git clone https://github.com/NodeBB/NodeBB.git
#安装依赖
cd NodeBB
cnpm install
#初始化
./nodebb setup

这个时候可以进行简单的设置了,他会提示你:

Welcome to NodeBB v1.13.1!

This looks like a new installation, so you'll have to answer a few questions about your environment before we can proceed.
Press enter to accept the default setting (shown in brackets).
URL used to access this NodeBB (http://localhost:4567) 
Please enter a NodeBB secret (f560ba0d-1665-40a2-8703-43036d6f21fe) 
Would you like to submit anonymous plugin usage to nbbpm? (yes) 
Which database to use (mongo) redis

到这一步的时候,看你用Mongodb还是Redis,我这里是Redis
接下来看个人设置了,一般回车就行,然后设置完了他就会开始构建前端这些文件

等到出现

NodeBB Setup Completed. Run "./nodebb start" to manually start your NodeBB server.

Starting NodeBB
  "./nodebb stop" to stop the NodeBB server
  "./nodebb log" to view server output
  "./nodebb help" for more commands

就说明OK了

但是我们肯定不能用4567这个端口对不对,所以得用Nginx反代它

假设你已经在宝塔上解析好域名和配置好SSL

接下来在宝塔的网站设置里面,添加反向代理,目标Url就填你的域名加端口4567

点保存,然后关掉,点反代的配置文件,里面全部删掉,填这个:

location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;

        proxy_pass http://你的域名:4567;
        proxy_redirect off;

        # Socket.IO Support
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }

别忘了改config.json里面的URL参数,一样的http://你的域名:4567

到这里差不多就大功告成了

./nodebb start

设置服务的话参考官方文档,建一个服务就好

https://docs.nodebb.org/configuring/running/

  1. lovart ai说道:

    Lovart AI Agent offers a fresh approach to design by merging AI and creativity. Its tri-modal interface and Figma integration could streamline workflows for designers seeking efficiency without sacrificing artistry.

  2. Esse guia de fb777 casino ph register é de utilidade pública! Tava empacado nessa parte. Agora sim! Quando não estou no PC, estou tentando ser um mestre churrasqueiro. Mas pra ser mestre nos slots, preciso primeiro me registrar, né? Haha.

发表回复

电子邮件地址不会被公开,仅用作获取Avatar。必填项已用 * 标注