Skip to content

安装手册

  • 提供 宝塔资料 可帮忙安装

环境要求

  • PHP >= 8.2

      - fileinfo
      - redis
    
  • MySQL >= 5.7

  • Redis >= 5.0

(开发环境php8.2 测试环境php8.3)

1. 删除php禁用函数

ssh
curl -Ss https://www.workerman.net/webman/fix-disable-functions | php

2. 还原数据库,并配置.env中数据库资料

3. jwt密钥资料

ssh
// 获取32位随机字符串操作命令
openssl rand -base64 32 | tr -d '=+/' | cut -c1-32

4. 启动服务

ssh
// 演示启动
php start.php start
// 正式使用
php start.php start -d
// 服务重载
php start.php reload
// 更多命令详见

5. Nginx配置

伪静态 (消息推送服务)

nginx
    location ^~ /push {
      proxy_pass http://127.0.0.1:3939;
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "Upgrade";
      proxy_set_header X-Real-IP $remote_addr;
    }

反向代理

nginx
// 目标URL
http://127.0.0.1:7979

6. 常见问题

  1. 使用curl、pgsql等请求HTTPS网站或建立SSL连接时,可能有 error:80000002:system library::No such file or directory 错误,请参考如下命令配置cert.pem文件。
// 命令行中运行一次即可
sudo mkdir -p /etc/ssl/certs && sudo  curl -o /etc/ssl/certs/ca-certificates.crt https://curl.se/ca/cacert-2024-09-24.pem
  1. 如果删除过vendor。composer install后模版不存在

答:设定的是把前端构建项目作为模版放到 public下使用,需要匹配正确的js css 图片资源路径,所以需要修改模版的渲染机制:

  `vendor/workerman/webman-framework/src/support/view/ThinkPHP.php`
    搜索  `$viewPath = base_path() . dirname($template) . '/';`
    改为  `$viewPath = dirname($template) . '/';`

- 代码修改后,需要重新启动服务