针对已安装宝塔面板的Linux服务器
1、PHP(建议使用5.6以上版本)、
2、服务器放行9501、6379端口
3、在当前php版本中安装插件Redis、Swoole
Redis、Swoole
Redis配置
wwwroot/www.demo.com/data/config.php
1. 修改$config['setting']['cache'] = 'mysql';为$config['setting']['cache'] = 'redis';
// -------------------------- CONFIG SETTING --------------------------- //
$config['setting']['charset'] = 'utf-8';
$config['setting']['timezone'] = 'Asia/Shanghai';
$config['setting']['memory_limit'] = '256M';
$config['setting']['filemode'] = 0644;
$config['setting']['authkey'] = 'c445a6b6';
$config['setting']['founder'] = '1';
$config['setting']['development'] = 0;
$config['setting']['referrer'] = 0;
2、redis服务器地址和端口
// -------------------------- CONFIG REDIS --------------------------- //
$config['setting']['redis']['server'] = '127.0.0.1'; //默认本地,你也可以用云库地址(远程)
$config['setting']['redis']['port'] = 6379; //默认端口
$config['setting']['redis']['pconnect'] = 1;
$config['setting']['redis']['auth'] = ''; //redis密码, 默认为空
$config['setting']['redis']['requirepass'] = ''; //redis密码,默认为空,没用人人商城删除这行
$config['setting']['redis']['timeout'] = 1;
Swoole配置
addons/ewei_shopv2/core/socket下socket.config.php
1、// 设置服务端IP
define('SOCKET_SERVER_IP', 'localhost');
2、// 不管是否开启https均需配置域名
define('SOCKET_CLIENT_IP', ' www.demo.com ');
手动启动
/www/server/php/56/bin/php -f /www/wwwroot/ www.demo.com /addons/ewei_shopv2/core/socket/server.php
自动启动
echo "/www/server/php/56/bin/php -f /www/wwwroot/ www.demo.com /addons/ewei_shopv2/core/socket/server.php" >> /etc/rc.d/rc.local