Apache2 ReverseProxy 到 Nginx Unit 子文件夹问题

Apache2 ReverseProxy 到 Nginx Unit 子文件夹问题

我想在 Apache2 中配置一个简单的反向代理来使用 Nginx Unit

   <Location /nextcloud>
        RequestHeader set X-Forwarded-Proto "https"
        RequestHeader set X-Forwarded-Port "443"
    </Location>

    ProxyPass /nextcloud http://127.0.0.1:7788
    ProxyPassReverse /nextcloud http://127.0.0.1:7788

Nginx单元配置成功

curl -X DELETE --unix-socket /var/run/control.unit.sock http://localhost/config/
curl -X PUT --data-binary @config.json --unix-socket /var/run/control.unit.sock http://localhost/config/
tail -n 20 /var/log/unit.log

Nginx Unit Nextcloud 配置示例来自此处:https://unit.nginx.org/howto/nextcloud/

按预期工作,但我无法告诉 Nginx 单元应用程序将在“/nextcloud”子文件夹中提供,调用 https://localhost/nextcloud 重定向到 https://localhost/index.php

我猜测这可能是单位路线内部的问题:

    "routes": [
        {
            "match": {
                "uri": [
                    "/build/*",
                    "/tests/*",
                    "/config/*",
                    "/lib/*",
                    "/3rdparty/*",
                    "/templates/*",
                    "/data/*",
                    "/.*",
                    "/autotest*",
                    "/occ*",
                    "/issue*",
                    "/indie*",
                    "/db_*",
                    "/console*"
                ]
            },

            "action": {
                "return": 404
            }
        },
        {
            "match": {
                "uri": [
                    "/core/ajax/update.php*",
                    "/cron.php*",
                    "/index.php*",
                    "/ocm-provider*.php*",
                    "/ocs-provider*.php*",
                    "/ocs/v1.php*",
                    "/ocs/v2.php*",
                    "/public.php*",
                    "/remote.php*",
                    "/status.php*",
                    "/updater*.php*"
                ]
            },

            "action": {
                "pass": "applications/nextcloud/direct"
            }
        },
        {
            "match": {
                "uri": "/ocm-provider*"
            },

            "action": {
                "pass": "applications/nextcloud/ocm"
            }
        },
        {
            "match": {
                "uri": "/ocs-provider*"
            },

            "action": {
                "pass": "applications/nextcloud/ocs"
            }
        },
        {
            "match": {
                "uri": "/updater*"
            },

            "action": {
                "pass": "applications/nextcloud/updater"
            }
        },
        {
            "action": {
                "share": "/var/www/nextcloud-test/nextcloud-files$uri",
                "fallback": {
                    "pass": "applications/nextcloud/index"
                }
            }
        }
    ],

有人已经有一些将 nginx 单元托管应用程序定向到子文件夹的经验吗?

Nextcloud 明智配置已调整

  'overwrite.cli.url' => 'https://localhost/nextcloud',
  'overwriteprotocol' => 'https',
  'overwritehost' => 'localhost',
  'overwritewebroot' => '/nextcloud',

相关内容