大大优化了环境配置方面的方法,让不会配置es环境的小伙伴按照步骤有手就能搭起来。 合约交易所从此搭建变得超级简单。 ------------------------------------------------------------- nginx+php7.3+mysql5.6+redis 需要安装的拓展 fileinfo opcache memcache redis imagemagick imap exif intl xsl 禁用函数最好全删,或者根据启动脚本时候报错去删也可以 为了避免意向不到的错误最好是新装系统服务器 只能装一个PHP,不然会受到干扰(大多报错是因为其他php服务导致的) 拓展和函数处理一定要处理好,不然报错就什么都启动不了。 ------------------------------------------------------------- 伪静态 location / { try_files $uri $uri/ /index.php$is_args$query_string; } ------------------------------------------------------------- 关闭防跨站攻击 ------------------------------------------------------------- 开放端口 放行端口:[1-65000] ------------------------------------------------------------------- ES环境配置方法 1.终端下执行 rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch 2.vi /etc/yum.repos.d/elasticsearch.repo [elasticsearch-7.x] name=Elasticsearch repository for 7.x packages baseurl=https://artifacts.elastic.co/packages/7.x/yum gpgcheck=1 gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch enabled=1 autorefresh=1 type=rpm-md 3.yum install elasticsearch -y 安装es版本完成后启动 4.service elasticsearch start 显示OK就是启动成功了 5.根目录终端下执行清楚缓存命令 cd /www/wwwroot/网站目录 php artisan config:cache cd /www/wwwroot/网站目录 php artisan cache:clear -------------------------------------------------------------------------- 上传源码,导入数据库 修改网站根目录env文件里的数据库信息和redis配置信息即可 其他不需要动 ------------------------------------------------------------------ 反向代理: location ~/(wss|socket.io)/ { # 此处改为 socket.io 后端的 ip 和端⼝即可 proxy_pass http://127.0.0.1:2000; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_http_version 1.1; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; } --------------------- 以下是计划任务脚本 前面都要带(cd /www/wwwroot/网站目录) ------------------------------------------------------------- python(这一步有的程序不需要,程序需要python支持的才需要启动,需要先启动reids和es) 拓展:redis websocker-client 拓展安装方法: yum install python3 -y pip3 install websocket-client redis 安装redis yum install python3 -y yum install redis -y 安装nodejs curl --silent --location https://rpm.nodesource.com/setup_14.x | bash - yum install nodejs ----------------------------- 1.python启动 cd /www/wwwroot/网站目录/python python3 main.py 2.先启动wss cd /www/wwwroot/网站目录/public/vendor/webmsgsender php start.php start -d (重启) cd /www/wwwroot/网站目录/public/vendor/webmsgsender php start.php restart -d 每天, 1点30分 执行 3.行情K线波动 cd /www/wwwroot/网站目录 php artisan websocket:client start ----------------------------------- 4.自动币币交易 cd /www/wwwroot/网站目录 php artisan cache:clear php artisan config:cache php artisan auto_change start 5.更新合约交易 cd /www/wwwroot/网站目录 php artisan queue:work 每天, 1点30分 执行 5.定时任务 cd /www/wwwroot/网站目录 php artisan schedule:run 每天, 1点30分 执行 7.获取交易对 cd /www/wwwroot/网站目录 php artisan get_market 每天, 1点30分 执行 8.获取k线数据 cd /www/wwwroot/网站目录 php artisan get_kline_data 每天, 1点30分 执行 9.历史数据 cd /www/wwwroot/网站目录 php artisan historical_data -------------------------------- 以下是平台币支持需要 ------------------------------ 每周 10.获取月k线 php artisan get_kline_data_monthly 每月 11.获取周k线 php artisan get_kline_data_weekly 每周 12.获取日k线 php artisan get_kline_data_daily 每日 10.获取小时k线 cd /www/wwwroot/网站目录 php artisan get_kline_data_hourly 每小时 13.获取30分k线 cd /www/wwwroot/网站目录 php artisan get_kline_data_thirtymin 30分 14.获取15分k线 cd /www/wwwroot/网站目录 php artisan get_kline_data_fifteenmin 15.获取5分k线 cd /www/wwwroot/网站目录 php artisan get_kline_data_fivemin ------------------------------------- 每分 16.更新用户余额 cd /www/wwwroot/网站目录 php artisan update_balance 每分 机器人自助下单 cd /www/wwwroot/网站目录 php artisan auto_order {ID} 重启机器人 cd /www/wwwroot/网站目录 php artisan robot {id} 奖金算法 cd /www/wwwroot/网站目录 php artisan bonus_algorithm 上币执行脚本 cd /www/wwwroot/网站目录 php artisan execute_currency {id} 搜索引擎 cd /www/wwwroot/网站目录 php artisan market:import 自动取消24小时C2C发布 php artisan auto_cancel_c2c 每24小时 锁仓挖矿结算 https://xxxx.com/api/lh/interest -------------------------------------------------------------------------- 执行 laravel对应的php artisan 、 php composer 命令时,均需要进行指定执行的php版本,也就是要指定php的绝对路径。 计划任务脚本如下: cd /www/wwwroot/网站目录 /www/server/php/72/bin/php artisan get_kline_data ----------------------------------------------------------------- 初始化脚本代码:start.sh #! /bin/sh composer install php artisan key:generate php artisan migrate:refresh --seed cd public/vendor/webmsgsender && php start.php start -d