zxd3014779200

flatris:搭建一个俄罗斯方块在线对战平台
项目地址:https://github.com/skidding/flatris环境:nodsjs服务器系统:ce...
扫描右侧二维码阅读全文
26
2020/06

flatris:搭建一个俄罗斯方块在线对战平台

项目地址:https://github.com/skidding/flatris
环境:nodsjs
服务器系统:centos7

首先更新系统

yum -y update

然后安装环境

yum -y install nodejs

安装管理器n

npm install -g n

安装nodejs最新版本

n latest

切换最新版本(回车确认)

n

安装yarn

npm install -g yarn

拉取一下项目文件,没安装git的先安装git

yum -y install git
git clone https://github.com/skidding/flatris

进入项目文件夹

cd flatris

文件重命名

mv .env.example.js .env.js

安装

yarn install

构建

yarn build

启动

yarn start

默认运行在3000端口,请将对应的防火墙打开,没有特殊要求的话,已经搭建完成

如果要解决后台运行的问题,先按ctrl+c退出,然后安装screen

yum -y install screen

创建一个后台终端

screen -S flatris

继续启动

yarn start

这样即使你关闭ssh,对战平台也会继续运行

但是我们可以看到,现在我们用的是ip+端口的方式访问的,怎样使用域名访问呢

我使用的方法是反代

由于我已经安装好了宝塔面板,所以直接创建站点,点击反向代理

目标URL设置为http://127.0.0.1:3000

保存之后,访问站点域名就能打开对战平台了

演示站点:https://game.v2ex.ltd/

Last modification:June 26th, 2020 at 12:58 pm
If you think my article is useful to you, please feel free to appreciate

Leave a Comment