6

宝塔面板+Fiora安装Web在线多人匿名聊天室教程

 2 years ago
source link: https://www.huhexian.com/11814.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

宝塔面板+Fiora安装Web在线多人匿名聊天室教程

青山 2021-11-1715:14:38评论2764字

Fiora是一款偏二次元的Web多人在线聊天应用,是使用Node.js、Mongodb、Socket.io和React编写的,使用起来简洁、方便,在这里使用宝塔面板+Fiora安装Web在线多人匿名聊天室教程分享给大家,有兴趣的可以玩玩。

宝塔面板+Fiora安装Web在线多人匿名聊天室教程宝塔面板+Fiora安装Web在线多人匿名聊天室教程功能

好友,群组,私聊,群聊

文本,图片,代码,url等多种类型消息

贴吧表情,滑稽表情,搜索表情包

桌面通知,声音提醒,语音播报

自定义桌面背景,主题颜色,文本颜色

查看在线用户,@功能

小黑屋禁言

宝塔安装

1、安装宝塔

  1. #CentOS系统
  2. wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh
  3. #Ubuntu系统
  4. wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh
  5. #Debian系统
  6. wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && bash install.sh

安装完成后,进入面板,点击左侧软件商店,然后安装PM2管理器、MongoDB、Nginx(使用域名访问才需要安装,反之不用)。

注意:Debian安装MongoDb之前还需要使用命令apt install sudo,不然可能存在MongoDb启动不了的情况;如果你已经安装了MongoDb,那就先使用apt install sudo,再使用/etc/init.d/mongodb start启动即可。

2、安装fiora

  1. #拉取源码并存放于/opt文件夹
  2. git clone https://github.com/yinxin630/fiora.git -b master /opt/fiora
  3. cd /opt/fiora
  4. #安装依赖,这里不能用npm,需要用yarn来安装
  5. npm i -g yarn
  6. npm run build
  7. #转移产物
  8. npm run move-dist
  9. npm start

运行后打开网站ip:9200,注册一个账号,然后可以看SSH客户端运行日志,获取自己的userId。

注意:需在宝塔的“安全”-“防火墙”中添加放开9200端口后网站ip:9200才能正常打开。

  1. #这里注册或登录的时候返回的信息,后面的5e157f7f0fff4748b7277563则为自己的userId
  2. <-- getLinkmansLastMessages mYNheu93jds7 5e157f7f0fff4748b7277563

如果网站ip:9200打不开的,可以检查下防火墙,CentOS系统可以使用以下命令:

  1. #CentOS 6
  2. iptables -I INPUT -p tcp --dport 9200 -j ACCEPT
  3. service iptables save
  4. service iptables restart
  5. #CentOS 7
  6. firewall-cmd --zone=public --add-port=9200/tcp --permanent
  7. firewall-cmd --reload

像阿里云等,还需要额外在安全组开放端口。

接下来再将自己的账号设置成管理员,先使用Ctrl+C断开运行。

新建Systemd配置文件,只适用于CentOS 7、Debian 8+、Ubuntu 16+等。

  1. #先给node做个软连接,不然后面会启动失败
  2. ln -sf $(which node) /usr/bin/node
  3. #修改运行端口,可以默认
  4. Port=9200
  5. #以下命令一起复制进SSH客户端运行
  6. cat > /etc/systemd/system/fiora.service <<EOF
  7. [Unit]
  8. Description=fiora
  9. After=network.target
  10. Wants=network.target
  11. [Service]
  12. Type=simple
  13. PIDFile=/var/run/fiora.pid
  14. ExecStart=$(command -v npm) start
  15. WorkingDirectory=/opt/fiora
  16. Environment=NODE_ENV=production Administrator=$Administrator Port=$Port
  17. User=fiora
  18. Restart=on-failure
  19. RestartSec=42s
  20. [Install]
  21. WantedBy=multi-user.target

开始启动并设置开机自启:

  1. systemctl start fiora
  2. systemctl enable fiora

其它系统,比如CentOS、Debian 7等系统,可以直接使用以下方法启动:

  1. #管理员userId和运行端口自行修改
  2. export Administrator=5e157f7f0fff4748b7277563 Port=9200
  3. nohup npm start &

此时就可以访问网站ip:9200,运行端口以你设置的为准,这时候你登陆的时候,会发现左侧多了个管理员图标。

3、启动网站(网站打不开时)

  1. cd /opt/fiora
  2. npm start

4、域名反代

方式一、修改站点配置实现

先点击左侧网站,添加站点,然后再点击添加好了的域名名称,这时候就进入了站点配置,点击配置文件,在“#引用反向代理规则,注释后配置的反向代理将无效”此句前添加以下代码:

  1. location / {
  2. proxy_pass http://127.0.0.1:9200;
  3. proxy_set_header Host $host;
  4. proxy_set_header X-Real-IP $remote_addr;
  5. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  6. proxy_set_header Upgrade $http_upgrade;
  7. proxy_set_header Connection "upgrade";
  8. proxy_set_header X-Forward-Proto http;
  9. proxy_set_header X-Nginx-Proxy true;
  10. proxy_http_version 1.1;
  11. proxy_redirect off;

方式二、用反向代理菜单实现。

先点击左侧网站,添加站点,然后再点击添加好了的域名名称,这时候就进入了站点修改,在点击“反向代理”选择“添加反向代理”

开启代理,代理名称随意填,目标URL填“http://网站ip:9200”即可。

修改侧边栏可在public/js的app.xxxxxx.js中修改,修改后删除nginx缓存(/www/server/nginx/proxy_cache_dir 下所有文件),重启nginx即可。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK