演示系统:Centos 7.6
1、安装宝塔
yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh
输入y回车确认安装
安装环境:
Nginx 1.18
mysql 5.7
PHP 7.2
mongo4.0
redis7.2
宝塔放行端口:1-65535
关闭防火墙:
systemctl stop firewalld
systemctl disable firewalld
关闭mongo安全验证
宝塔-软件商店-已安装-MongoDB 4.0.10-配置项
关闭安全认证
上传服务端home.zip到服务器根目录
解压
cd /
unzip home.zip
给权限
chmod 777 -R /home/
安装openresty1.19.3.1
cd /home/proj
wget https://openresty.org/download/openresty-1.19.3.1.tar.gz
tar -zxvf openresty-1.19.3.1.tar.gz
mv openresty-1.19.3.1 openresty
cd openresty
sudo yum install -y pcre-devel openssl-devel
./configure
make
make install
配置环境变量
echo “openresty环境变量”
echo “PATH=/usr/local/openresty/bin:/usr/local/openresty/nginx/sbin:$PATH
export LC_ALL=en_US.UTF-8
export PATH” >> ~/.bash_profile
立即生效
source ~/.bash_profile
设置数据库密码为:123456
导入数据库
mysql -uroot -p123456
create database sanguo DEFAULT CHARACTER SET utf8;
flush privileges; #
use sanguo
source /home/sql/sanguo.sql
exit;
宝塔添加站点:
IP:85端口
网站目录指向:/home/proj/goserver/admin/assets/web/dist
127.0.0.1:82端口
网站目录指向:/home/proj/web-mobile
修改服务端IP:替换123.207.42.5为你自己的ip
使用命令修改IP 把:‘你的IP’替换成服务器外网IP再运行命令
find /home/proj/ -type f -name ‘*.*’ | xargs sed -i ‘s/123.207.42.5/你的IP/g’
find /home/proj/ -type f -name ‘*.py’ | xargs sed -i ‘s/123.207.42.5/你的IP/g’
find /home/proj/ -type f -name ‘*.js’ | xargs sed -i ‘s/123.207.42.5/你的IP/g’
find /home/proj/ -type f -name ‘*.development’ | xargs sed -i ‘s/123.207.42.5/你的IP/g’
以下是具体文件路径:
\home\proj\common\settings.lua (2 hits)
\home\proj\goserver\admin\assets\web\.env.development (1 hit)
\home\proj\goserver\admin\assets\web\dist\js\app.3d18e251.js (2 hits)
\home\proj\goserver\admin\assets\web\dist\js\highlight.js.0adc4c0f.js (1 hit)
\home\proj\goserver\agent_admin\agent_assets\web\.env.development (1 hit)
\home\proj\goserver\agent_admin\agent_assets\web\dist\js\app.bfd4e5a3.js (2 hits)
\home\proj\goserver\agent_admin\agent_assets\web\dist\js\highlight.js.0adc4c0f.js (1 hit)
\home\proj\pyapi\wxpay\app.py (1 hit)
\home\proj\web-mobile\assets\main\index.bcc80.js (3 hits)
\home\proj\web-mobile\assets\resources\import\24\241bc4ec-587f-41fa-a24d-e904c5f906c6.9f804.json (1 hit)
启动服务器
启动apiserver
cd /home/proj/apiserver
nginx -p `pwd` -c conf/nginx.conf
启动gameserver
cd /home/proj/skynet
sh getkey.sh
生成key,请在/home/proj/skynet文件夹下创建key.txt将密钥放进去
./skynet ../loginserver/prodconfig
./skynet ../gameserver/prodconfig
d55459745fc06693f3cf71b184791b153efd276c
启动goserver
cd /home/proj/goserver
./mygo
这个可以不启动,启动pyapi
cd /home/proj/pyapi/kefu
python main.py
cd /home/proj/pyapi/wxpay
sh start.sh
停止apiserver
cd /home/proj/apiserver
nginx -p `pwd` -c conf/nginx.conf -s stop
游戏地址
http://IP:82
后端地址:
http://ip:85/#/login?next=%2F
账号:admin
密码:admin
登陆后到 游戏配置-区服配置 新增一个大区 再点开服,默认保存就行,开服活动自行研究
PS:手动启动芒果
/etc/init.d/mongodb start
yum -y install sudo