Repository navigation
Description
Steps To Reproduce
Hi,
I decided to build my application image based on Nginx Unit. I am having difficulty applying the custom server configuration due to errors found in the scripts.
Outcome
-
Disabling logging of healthcheck does not work. Although there is a rule in the configuration, it is always overwritten by the script. Custom additional configs cannot affect this. You should delete the specified line in the initialization script.
-
Private IP address ranges are missing in the reverse proxy configuration, although they are specified in Nginx. I want to use Unit as an application server located behind the upstream Nginx on the host.
-
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.
Affected Docker Images
- serversideup/php:7.4-unit
Anything else?
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
jaydrogers commentedon Aug 13, 2024
Thanks for opening this up! Yes, this was the first Unit configuration that I wrote and I am still learning.
I'd be glad to take on a PR if you have more experience. I'd like it to replicate the features of the
fpm-nginxas much as possible.TheAndrey commentedon Aug 13, 2024
I'm also getting to know Unit for now. I solved problems by studying the documentation. I'm still working on the config. On your part, you need to finalize the configuration scripts.
Next problem. Any scripts located in
/etc/unit/config.dcompletely overwrite the Unit configuration. To avoid this, we need to be able to specify the URI where the configuration file will be uploaded, as described in the documentation.I still don't understand why SSL support and Cloudflare IP processing are needed, if this should be handled by a upstream server. This only complicates the configuration. The task of the application server is only route processing.
jaydrogers commentedon Aug 13, 2024
We can't always assume this, so that's why we have this included.
Keep me posted on what you learn and I'd love to review any suggestions for improvement.
jaydrogers commentedon Oct 2, 2024
Thanks again for your report @TheAndrey!
I am working on v3.4 and I am breaking your suggestions into different tasks. Here is where everything at:
I will update each issue individually and close this one. I appreciate your feedback!