nginx / unit

NGINX Unit - universal web app server - a lightweight and versatile open source server that simplifies the application stack by natively executing application code across eight different programming language runtimes.
https://unit.nginx.org
Apache License 2.0
5.27k stars 322 forks source link

Add support for PHP `$uri`, `index`, *then* `script` #1078

Open mqudsi opened 5 months ago

mqudsi commented 5 months ago

Presently, including a script app.php in a nginx-unit php application's definition causes any requests to that app to execute script, ignoring $uri and index.

This causes a problem for a lot of configurations where virtual paths are used in the same namespace (prefixed path) as physical php files, e.g. given the following directory tree, there is no way to service all of the following requests without pre-enumerating all possible directory names or all possible filename patterns:

app-root/
├─ dir1/
│  ├─ index.php
│  ├─ script.php
├─ static-file.css
├─ main.php
    "applications": {
        "php": {
            "type": "php",
            "targets": {
                "direct": {
                    "index": "index.php",
                    "root": "/var/www/app-root/"
                },
                "main": {
                    "index": "index.php",
                    "script": "main.php",
                    "root": "/var/www/app-root/"
                }
            },
tippexs commented 5 months ago

@mqudsi Thanks for reporting this. Can you please provide your Unit routes configuration? That would be great. We will make sure we will look into this. I have some quite large configuration and I just want to make sure I can see your routes configuration before sharing any more information.