I am attempting to create a suite of dokuwiki's and thus want to leverage the farms.
I am however struggling as the instructions are for apache. I can get a single dokuwiki running just fine but I am unable to produce a working farm concept via rewrite
The reference material I have been using is:
https://www.dokuwiki.org/farms
https://www.dokuwiki.org/farms:example01
https://www.dokuwiki.org/tips:redirect_farm
the redirect_farm is the one I have been concentrating on, especially step2 **Setup the URL binding**
> Here we describe the simples URL rewrite method, using .htaccess under
> Apache.
>
> Copy the following to /var/www/barn/.htaccess:
.htaccess
RewriteEngine On
RewriteRule ^/?([^/]+)/(.*) /farmer/$2?animal=$1 [QSA]
RewriteRule ^/?([^/]+)$ /farmer/?animal=$1 [QSA]
Options +FollowSymLinks
> Test: Point your browser to http://localhost/barn/foo. You should see
> the index of farmer. Point to http://localhost/barn/foo/bar. You
> should get a 404 error “The requested URL /farmer/bar was not found”.
> This shows that the URL binding works.
>
> If the test fails:
>
> .htaccess must be enabled in the in the Apache Configuration
> (AllowOverride All); mod_rewrite must be Included. If you have a
> redirection loop, your DocumentRoot needs to be /var/www/ (neither
> /var/www/farmer/ nor /var/www/barn/).
I have a sparce localhost.conf to recreate this and have included the equivalent rewrite:
server {
listen 80;
server_name localhost;
access_log /var/log/nginx/localhost_access_log main;
error_log /var/log/nginx/localhost_error_log info;
rewrite_log on;
root /var/www/localhost/htdocs;
#location ~ /(data/|conf/|bin/|inc/|install.php) { deny all; }
location / {
autoindex on;
}
location /barn/ {
#try_files $uri $uri/ /wiki/doku.php @wiki;
autoindex on;
#alias /var/www/localhost/htdocs/farmer;
rewrite ^/?([^/]+)/(.*) /farmer/$2?animal=$1 ;
rewrite ^/?([^/]+)$ /farmer/?animal=$1 ;
}
#location ~ \.php$ {
# try_files $uri =404;
# include /etc/nginx/fastcgi.conf;
# fastcgi_pass 127.0.0.1:9000;
#}
}
when I goto http://localhost I see "**farmer**" and "**barn**". When I browser "**farmer**" it lists as "**farmer**". When I go into "barn" it lists as "farmer" so aspects of the rewrite are working.
However... http://localhost/barn/foo returns 404 and this should list **farmer**. Looking at the debug logs:
2018/07/07 15:25:41 [notice] 17845#17845: *1 "^/?([^/]+)/(.*)" matches "/barn/", client: 127.0.0.1, server: localhost, request: "GET /barn/ HTTP/1.1", host: "localhost", referrer: "http://localhost/"
2018/07/07 15:25:41 [notice] 17845#17845: *1 rewritten data: "/farmer/", args: "animal=barn", client: 127.0.0.1, server: localhost, request: "GET /barn/ HTTP/1.1", host: "localhost", referrer: "http://localhost/"
regex has detected but the wrong rewrite... the animal=barn shouldn't be such.
likewise:
2018/07/07 15:25:44 [notice] 17845#17845: *1 rewritten data: "/farmer/foo/", args: "animal=barn", client: 127.0.0.1, server: localhost, request: "GET /barn/foo/ HTTP/1.1", host: "localhost"
2018/07/07 15:25:44 [notice] 17845#17845: *1 "^/?([^/]+)$" does not match "/farmer/foo/", client: 127.0.0.1, server: localhost, request: "GET /barn/foo/ HTTP/1.1", host: "localhost"
2018/07/07 15:25:44 [error] 17845#17845: *1 "/var/www/localhost/htdocs/farmer/foo/index.html" is not found (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET /barn/foo/ HTTP/1.1", host: "localhost"
I feel I am close but equally I now got to the point I don't understand nginx rewrite or what is needed for dokuwiki. any adive?
Asked by Naib
(101 rep)
Jul 7, 2018, 02:34 PM
Last activity: Jul 8, 2018, 09:56 AM
Last activity: Jul 8, 2018, 09:56 AM