NGINX Unit

phpMyAdmin§

要使用 Unit 运行 phpMyAdmin Web 工具

  1. 安装 Unit,其中包含 PHP 语言模块。

  2. 安装并配置 phpMyAdmin 的 先决条件

  3. 安装 phpMyAdmin 的 核心文件。在此,我们将其安装在 /path/to/app/;在配置中使用真实路径。

    注意

    务必 手动或使用 设置脚本创建 config.inc.php 文件。

  4. 运行以下命令,以便 Unit 可以访问 应用程序目录

    # chown -R unit:unit /path/to/app/
    

    注意

    unit:unit 用户组对仅适用于 官方软件包、Docker 镜像和某些 第三方存储库。否则,帐户名称可能有所不同;运行 ps aux | grep unitd 命令以确定。

    有关更多详细信息,包括权限,请参阅 安全检查列表

  5. 接下来,准备 Unit 的 phpMyAdmin 配置(对 shareroot 使用真实值)

    {
        "listeners": {
            "*:80": {
                "pass": "routes"
            }
        },
    
        "routes": [
            {
                "match": {
                    "uri": "~\\.(css|gif|html?|ico|jpg|js(on)?|png|svg|ttf|woff2?)$"
                },
    
                "action": {
                    "share": "/path/to/app$uri"
                }
            },
            {
                "action": {
                    "pass": "applications/phpmyadmin"
                }
            }
        ],
    
        "applications": {
            "phpmyadmin": {
                "type": "php",
                "root": "/path/to/app/"
            }
        }
    }
    
  6. 上传更新后的配置。假设上述 JSON 已添加到 config.json

    # curl -X PUT --data-binary @config.json --unix-socket \
           /path/to/control.unit.sock http://localhost/config/
    

    注意

    控制套接字路径可能有所不同;运行 unitd -h 或参阅 启动和关闭了解详细信息。

    更新成功后,应可在侦听器的 IP 地址和端口上使用 phpMyAdmin

    phpMyAdmin on Unit