Skip to content

Unit: Configuration only works with index.php #450

@jaydrogers

Description

@jaydrogers

Steps To Reproduce

TBD

Outcome

What did you expect?

  • All PHP files should be processed as PHP

What happened instead?

  • PHP files are being downloaded

Affected Docker Images

Unit images only

Anything else?

Originally reported by @TheAndrey in #412:

The current configuration is very crude. I had to completely rewrite the config. In this case, it only works index.php at the same time, all other php scripts are downloaded as regular files. index.php you can also download it if you specify its name in the URL.

I got something like this configuration with my fixes.

{

  "listeners": {
    "*:8080": {
      "pass": "routes",
      "forwarded": {
        "client_ip": "X-Forwarded-For",
        "protocol": "X-Forwarded-Proto",
        "recursive": false,
        "source": [
          "172.16.0.0/12"
        ]
      }
    }
  },

  "routes": [
    {
      "match": {
        "uri": "/healthcheck"
      },
      "action": {
        "return": 200
      }
    },
    {
      "match": {
        "uri": [
          "/",
          "*.php",
          "*.php/*"
        ]
      },
      "action": {
        "pass": "applications/php/direct"
      }
    },
    {
      "action": {
        "share": "/var/www/html/public$uri",
        "fallback": {
          "pass": "applications/php/index"
        }
      }
    }
  ],

  "applications": {
    "php": {
      "type": "php",
      "processes": {
        "max": 5,
        "spare": 1,
        "idle_timeout": 30
      },
      "targets": {
        "index": {
          "root": "/var/www/html/public/",
          "script": "index.php"
        },
        "direct": {
          "root": "/var/www/html/public/",
          "index": "index.php"
        }
      }
    }
  }

}

It is imperfect. index.php it does not start when going to the directory, unless you explicitly specify the URI in the config.

Metadata

Metadata

Assignees

Labels

🐛 Bug: ConfirmedBugs that are able to be replicated.🙏 Help WantedIssues that specifically could use some help from the community

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions