View previous topic :: View next topic |
Author |
Message |
Naib Watchman
Joined: 21 May 2004 Posts: 6051 Location: Removed by Neddy
|
Posted: Sun Jul 01, 2018 11:45 pm Post subject: dokuwiki, nginx and farms |
|
|
I am messing around using my gentoo setup to test out a bug tracker (mantisBT) and wiki (dokuwiki) via nginx
This is very similar to what I have on my home NAS, but I am doing a clean setup on my desktop to ensure my steps are documented and not some frankenstein evolvement
so far so good, I have php running via php-fpm and mantisBT is working well. Likewise dokuwiki is working well.
What I would like is to make use of what dokuwiki refer to as farms ( https://www.dokuwiki.org/farms ) so that I can add multiple, independent wikis. I am a bit lost...
The howto is targeting apache and I am not sure how to map this to nginx.... any idea's?
present /etc/nginx/sites-available/localhost looks like:
Code: | server {
listen 80;
server_name localhost;
access_log /var/log/nginx/localhost_access_log main;
error_log /var/log/nginx/localhost_error_log info;
root /var/www/localhost/htdocs;
location / {
index index.html index.htm index.php;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
}
location @dokuwiki {
rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last;
rewrite ^/_detail/(.*) /lib/exe/detail.php?media=$1 last;
rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last;
rewrite ^/(.*) /doku.php?id=$1&$args last;
}
location ~ \.php$ {
# Test for non-existent scripts or throw a 404 error
# Without this line, nginx will blindly send any request ending in .php to php-fpm
try_files $uri =404;
include /etc/nginx/fastcgi.conf;
fastcgi_pass 127.0.0.1:9000; ## Make sure the socket corresponds with PHP-FPM conf file
}
} |
I have made the farm directory and seeded it with the _animal example, I am however unsure what to put in the nginx config to make use of this _________________
Quote: | Removed by Chiitoo |
|
|
Back to top |
|
|
Naib Watchman
Joined: 21 May 2004 Posts: 6051 Location: Removed by Neddy
|
Posted: Sat Jul 07, 2018 11:25 pm Post subject: |
|
|
Well I have a dirty hack... I don't like aspects of the nginx (ie the /cow and the /duck) but this works. Not sure what will break
/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:
Code: | if(!defined('DOKU_FARMDIR')) define('DOKU_FARMDIR', '/var/www/localhost/htdocs/barn'); |
cow/conf/local.protected.php is equally configured
Code: | $conf['basedir'] = '/barn/cow/'; |
duck/conf/local.protected.php is equally configured
Code: | $conf['basedir'] = '/barn/duck/'; |
now the nginx localhost.conf is configured such:
Code: | 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) _________________
Quote: | Removed by Chiitoo |
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|