-
Notifications
You must be signed in to change notification settings - Fork 332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nextcloud Pretty URLs #959
Comments
Do you mean that if you do
that Unit turns that into Perhaps if you could post your config (or at least what of it you can). |
Yes that is correct. URLs now have This may be long, I'm not sure if I know how to fold the config but here we are: I grabbed the configuration for the listeners, routes, and applications from the HOWTO on the Unit website.
|
Thanks! So, just trying to create a simple reproducer... index.php <?php
print_r($_SERVER);
?> unit.json {
"listeners": {
"[::1]:8080": {
"pass": "applications/php"
}
},
"applications": {
"php": {
"type": "php",
"targets": {
"test": {
"root": "/home/andrew/src/php",
"script": "index.php"
}
}
}
}
}
So I don't immediately see anything in your config that would be re-writing the request_uri. |
I'll try in the AM to see if I can get those variables to output while running a full blown copy of Nextcloud and report back. I'm seeing something similar that someone may be experiencing the same thing here nextcloud/docker#1610 in their statement of "Currently lacks support for some Nextcloud functionality, like pretty URLs". |
Looks like Pretty URLs require some URI rewrite "magic" to work properly. The magic itself is wrapped up in a Nextcloud occ script which (for Apache) creates some .htaccess rewrite rules, as described in this help article. Until 1.30.0, Unit did not have the ability to rewrite URIs. So we can probably get this working now :) |
Hi Folks - |
I was able to create a working configuration BUT the issue is not with the rewrites at all. I am able to inject an So my question is basically how to remove |
Nevermind! Goi it working. Will post by Configuration after some cleanup. |
The rewrite to add the My setup uses version 27.1.2. My configuration: {
"listeners": {
"*:80": {
"pass": "routes"
}
},
"routes": [
{
"match": {
"uri": [
"/.well-known/carddav",
"/.well-known/caldav"
]
},
"action": {
"return": 301,
"location": "/remote.php/dav"
}
},
{
"match": {
"uri": [
"/.well-known/*"
]
},
"action": {
"pass": "applications/nextcloud/index"
}
},
{
"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*",
"/ocs-provider*.php*",
"/ocs/v1.php*",
"/ocs/v2.php*",
"/public.php*",
"/remote.php*",
"/status.php*",
"/updater*.php*"
]
},
"action": {
"pass": "applications/nextcloud/direct"
}
},
{
"match": {
"uri": "/ocs-provider*"
},
"action": {
"pass": "applications/nextcloud/ocs"
}
},
{
"match": {
"uri": [
"/index.php",
"index.php/*"
]
},
"action": {
"pass": "applications/nextcloud/index"
}
},
{
"action": {
"share": "/var/www/html$uri",
"fallback": {
"pass": "applications/nextcloud/index"
}
}
}
],
"applications": {
"nextcloud": {
"type": "php",
"user": "www-data",
"processes": {},
"targets": {
"direct": {
"root": "/var/www/html/"
},
"index": {
"root": "/var/www/html/",
"script": "index.php"
},
"ocs": {
"root": "/var/www/html/ocs-provider/",
"script": "index.php"
}
}
}
},
"settings": {
"http": {
"log_route": true
}
}
}
'overwrite.cli.url' => 'http://localhost:8888',
'htaccess.IgnoreFrontController' => true, The The Feel free to dig a little bit deeper what the root cause is for this issue.
{
"action": {
"share": "/var/www/html$uri",
"fallback": {
"pass": "applications/nextcloud/index"
}
}
} It will pick the route
The {
"match": {
"uri": [
"/index.php",
"index.php/*"
]
},
"action": {
"rewrite": "index.php$request_uri",
"pass": "applications/nextcloud/index"
}
} BUT THIS IS NOT NEEDED with nextcloud version 27.
With 27 the response headers are alreday set. I have -NOT- looked into the code but I asume they will be set by PHP.
The Dockerfile for my test was genrated by the Thanks for that! My changes: diff --git a/update.sh b/update.sh
index 14981ea..3a0cf25 100755
--- a/update.sh
+++ b/update.sh
@@ -11,7 +11,7 @@ declare -A cmd=(
[apache]='apache2-foreground'
[fpm]='php-fpm'
[fpm-alpine]='php-fpm'
- [unit]='unitd --no-daemon --control unix:/var/run/control.unix.sock'
+ [unit]='unitd --no-daemon'
)
declare -A base=(
@@ -123,8 +123,8 @@ function create_variant() {
s/%%VARIANT%%/'"$variant"'/g;
s/%%VERSION%%/'"$fullversion"'/g;
s/%%BASE_DOWNLOAD_URL%%/'"$2"'/g;
- s/%%CMD%%/'"${cmd[$variant]}"'/g;
s|%%VARIANT_EXTRAS%%|'"${extras[$variant]}"'|g;
+ s/%%CMD%%/'"${cmd[$variant]}"'/g;
s/%%APCU_VERSION%%/'"${pecl_versions[APCu]}"'/g;
s/%%MEMCACHED_VERSION%%/'"${pecl_versions[memcached]}"'/g;
s/%%REDIS_VERSION%%/'"${pecl_versions[redis]}"'/g; Changes to the template diff --git a/Dockerfile-unit.template b/Dockerfile-unit.template
index c64e6d1..b1b9806 100644
--- a/Dockerfile-unit.template
+++ b/Dockerfile-unit.template
@@ -1,4 +1,4 @@
-FROM nginx/unit:%%UNIT_VERSION%%-php%%PHP_VERSION%%
+FROM unit:php
# entrypoint.sh and cron.sh dependencies
RUN set -ex; \ The official images are not available in PHP 8.1. See https://hub.docker.com/_/unit Wit the changes above you should be able to run I am really soory for the long delay and hope this is working for you. What version do you use? I am more than happy to give it a try with another version. Would it be helpful to push my updated version of the I think Unit is a strong alternative to the PHP-FPM! Happy to use this thread for further discussions. Let me know if this work for you. |
Wow - What a response! |
As a note, it seems that (with NC 27 at least) all that's necessary to get pretty URLs working is to set |
Neat project. I have been a long time fan of Nginx and PHP-FPM as a pair and decided to embark on converting many of my docker images to using Unit.
I followed the guide for Nextcloud and the configuration was easy enough to insert in. Howver, since I was using an openID Connect plugin I was locked out from being able to access the site. The reason why is that my URLs now contained
index.php
in the URL examplehost.domain.tld/index.php/apps/etc
. Previously with the Nginx examples I did not see that in the URL. I have years of URLs that may be bookmarked from users who with this new insertion would invalidate all of their previous links..In short, does anyone have a better configuration to enable these sort of pretty URLs?
The text was updated successfully, but these errors were encountered: