Table of Contents

Dokuwiki

Install

git clone https://github.com/splitbrain/dokuwiki.git
vim dokuwiki/inc/preload.php
 
sudo mkdir -p /var/lib/dokuwiki/default/conf
sudo cp -r dokuwiki/data /var/lib/dokuwiki/default
sudo cp -r dokuwiki/data /var/lib/dokuwiki/default
sudo cp dokuwiki/conf/users.auth.php.dist /var/lib/dokuwiki/default/conf/users.auth.php
sudo cp dokuwiki/conf/acl.auth.php.dist /var/lib/dokuwiki/default/conf/acl.auth.php
 
sudo rsync -avv --exclude=.git* --exclude=/data --exclude=install.php dokuwiki /var/www/
sudo chown -R apache:apache /var/lib/dokuwiki/default/data
sudo chown -R apache:apache /var/lib/dokuwiki/default/conf
 
sudo yum install php
sudo service httpd restart
preload.php
<?php
if(!defined('DOKU_FARMDIR')) define('DOKU_FARMDIR', '/var/lib/dokuwiki/' );
if(!defined('DOKU_CONF')) define('DOKU_CONF', DOKU_FARMDIR.'default/conf/');  ## disableing dynamic path selection
 
include(fullpath(dirname(__FILE__)).'/farm.php');
local.protected.php
<?php
$conf["savedir"]     = DOKU_FARMDIR."default/data";
$conf["useacl"]     = 1;
$conf["autopasswd"]     = 0;
$conf["superuser"]     = "alice,@admin";

rewrites

nginx/conf.d/dokuwiki.inc
  index  index.php index.html;
 
  client_max_body_size 1600m;
  fastcgi_read_timeout 180;
 
  location ~ ^/(data|conf|bin|inc)/ { return 444; }
  location ~ /\.ht { return 444; }
 
  location = /favicon.ico {
    log_not_found off;
    access_log off; }     
  location = /robots.txt {
    allow all;
    log_not_found off;
    access_log off; }
  location ~* \.(txt|log)$ {
    deny all; }
  location ~ \..*/.*\.php$ {
    return 403; }
  location ~ /\.ht {
    deny  all; }
  location / {  
    try_files $uri @rewrite; }       
 
  location @rewrite {
     rewrite ^/$ /doku.php last;
     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;
 
    ## styleimg is a template confhelper feature
     rewrite ^/_img/((.*)/)?(.*)        /lib/exe/fetch.php?mode=styleimg&media=$3&template=$2 last;
     rewrite ^/images/((.*)/)?(.*)      /lib/exe/fetch.php?mode=styleimg&media=$3&template=$2 last;
    ## force styleimage for template images ( out of root templates )
     rewrite ^/lib/tpl/((.*)/)?images/(.*)      /lib/exe/fetch.php?mode=styleimg&media=$3&template=$2 last;
 
     rewrite ^/(.*)?(.*)  /doku.php?id=$1&$2 last;
     break;       
 }

php-fpm

for reverse proxy setup see nginx

/etc/nginx/sites-available-notomorrow.de
client_max_body_size 50m;
fastcgi_read_timeout 180;
 
## needed because of the reverse proxy
## x_forwarded port ans stuff is set there
 
map $http_x_forwarded_port $external_port { 
    default $http_x_forwarded_port; 
    '' $server_port; 
}        
map $http_x_forwarded_proto $external_proto { 
    '' $https; 
    'http' ''; 
    'https' 'on'; 
}        
 
server { 
        listen [::]:80 default;
        server_name notomorrow.de *.notomorrow.de;
 
        error_log  /var/log/nginx/notomorrow.error.log;
        root   /srv/dokuwiki;
        index  index.php index.html;
 
        include        conf.d/status.inc;
        include        conf.d/public.inc;
        include        conf.d/dokuwiki.inc;
        include        conf.d/notomorrow.php.inc;
} 
/etc/nginx/conf.d/php.inc
location ~ \.php$ {
  fastcgi_split_path_info ^(.+\.php)(/.+)$;
  fastcgi_index  index.php;              
 
  #fastcgi_param  PATH_INFO          $fastcgi_path_info;
  #fastcgi_param  PATH_TRANSLATED    $document_root$fastcgi_path_info;
  #fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
 
  include fastcgi_params;                
 
  fastcgi_param  SERVER_PORT          $external_port;
  fastcgi_param  HTTPS                $external_proto; 
 
  fastcgi_intercept_errors on;           
  fastcgi_pass unix:/tmp/php-fpm-notomorrow.de.sock;
 
}    
/etc/php/fpm/pool.d/notomorrow.de.conf
[notomorrow.de]
 
user = notomorrow-de
group = notomorrow-de
listen.owner = notomorrow-de
listen.group = notomorrow-de
listen = '/tmp/php-fpm-notomorrow.de.sock'
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3

Log In