Skip to main content
added 1 character in body
Source Link
Naib
  • 101
  • 1

I can navigate to http://localhost/farmer for base, http://localhost/cow (redirecting to http://localhost/barbarn/cow/doku.php, internally rewritten as http://localhost/farmer/?animal=cow) for 1st animal and the same for the 2nd.

I can navigate to http://localhost/farmer for base, http://localhost/cow (redirecting to http://localhost/bar/cow/doku.php, internally rewritten as http://localhost/farmer/?animal=cow) for 1st animal and the same for the 2nd.

I can navigate to http://localhost/farmer for base, http://localhost/cow (redirecting to http://localhost/barn/cow/doku.php, internally rewritten as http://localhost/farmer/?animal=cow) for 1st animal and the same for the 2nd.

Source Link
Naib
  • 101
  • 1

Well I have sort of answered it...

/var/www/localhost/htdocs/farmer is the base dokuwiki

/var/www/localhost/htdocs/barn is a directory holding my farm

/var/www/localhost/htdocs/barn/cow is the 1st animal

/var/www/localhost/htdocs/barn/duck is the 2nd animal

farmer/inc/preload.php is configured as per the tips:

if(!defined('DOKU_FARMDIR')) define('DOKU_FARMDIR', '/var/www/localhost/htdocs/barn');

cow/conf/local.protected.php is equally configured

$conf['basedir'] = '/barn/cow/';

duck/conf/local.protected.php is equally configured

$conf['basedir'] = '/barn/duck/';

now the nginx localhost.conf is configured such:

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; } # post-install lockdown

    location / {
        try_files $uri $uri/ doku.php @farmer;
        autoindex on;
        }
    location /cow {
        return 301 http://$host/barn/cow/doku.php;
        }

    location /duck {
        return 301 http://$host/barn/duck/doku.php;
        }

        
    location ~ /barn {
        index doku.php;
        autoindex on;
        rewrite ^/barn/?([^/]+)/(.*) /farmer/$2?animal=$1;
        rewrite ^/barn/?([^/]+)$ /farmer/?animal=$1;
        }

    location @farmer {
            rewrite ^/farmer/_media/(.*) /lib/exe/fetch.php?media=$1;
            rewrite ^/farmer/_detail/(.*) /lib/exe/detail.php?media=$1;
            rewrite ^/farmer/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2;
            rewrite ^/farmer/(.*) /doku.php?id=$1&$args;
        }
 
    location ~ \.php$ {
        try_files $uri =404;
        include /etc/nginx/fastcgi.conf;
        fastcgi_pass 127.0.0.1:9000;  
    }

}

I can navigate to http://localhost/farmer for base, http://localhost/cow (redirecting to http://localhost/bar/cow/doku.php, internally rewritten as http://localhost/farmer/?animal=cow) for 1st animal and the same for the 2nd.

I don't like aspects of the nginx chainloading but it works(tm)