基于easyswoole开发的聊天室

基于easyswoole开发的聊天室

####基础运行环境
-  PHP 版本 7.1.33
- Swoole 拓展版本 4.5.3
- pcntl 拓展的任意版本
- Centos 7
- Composer 作为依赖管理工具

安装
-   首先准备两个端口8001 8088 注意防火墙开发端口
-   克隆代码 `https://gitee.com/ormcc/chat.git` 将项目克隆到本地
-   执行 `composer update` 此步骤可以省略已生成vendor
-   数据库 chat数据库,将chat.sql数据导入数据库
-   配置文件 `dev.php`,配置MYSQL,REDIS配置,修改MAIN_SERVER/PORT端口
-   Nginx代理,配置文件nginx.conf,包括https配置
 location / {
         root   /usr/local/www/chat/;
         proxy_http_version 1.1;
         proxy_set_header Connection "keep-alive";
         proxy_set_header X-Real-IP $remote_addr;
         if (!-e $request_filename) {
              proxy_pass http://127.0.0.1:8088;
         }
         if (!-f $request_filename) {
              proxy_pass http://127.0.0.1:8088;
         }
 }
 ```
 -   修改`App\HttpController\index.php的index`方法中的`$hostName`变量为当前域名ws地址,当前ip获取方法已写只需要修改端口即可
 -   运行 EasySwoole ` php easyswoole start` 守护进程 ` php easyswoole start d`
 -   此时访问 `https://chat.ormcc.com` 即可进入登录页面
 -   测试账号 `test1` - `test2` 密码 `123456`
 预览地址:https://chat.ormcc.com

#### 部分截图
![图片](https://img-blog.csdnimg.cn/img_convert/c5fd4878fc988454e742119dc45fcb04.png)
![图片](https://img-blog.csdnimg.cn/img_convert/6170657e81ad228b10369fa149d9175d.png)
![图片](https://img-blog.csdnimg.cn/img_convert/b8199b5d04061fef703b3801e7b1e91f.png)
![图片](https://img-blog.csdnimg.cn/img_convert/dfb8125bbd7a3ab14cfbbf82c65d8d38.png)

[2]: https://chat.ormcc.com "聊天室"

你可能感兴趣的:(swoole,聊天室,PHP,swoole,php)