Difference between revisions of "Dokuwiki"

From ArchWiki
Jump to: navigation, search
m (Cleaning Up)
(added nginx example)
(43 intermediate revisions by 21 users not shown)
Line 1: Line 1:
== Installing Dokuwiki ==
+
[[Category:Office]]
=== What is dokuwiki? ===
+
[[es:Dokuwiki]]
 
+
[[zh-TW:Dokuwiki]]
 
"DokuWiki is a standards-compliant, simple-to-use wiki which allows users to create rich documentation repositories. It provides an environment for individuals, teams and companies to create and collaborate using a simple yet powerful syntax that ensures data files remain structured and readable outside the wiki."
 
"DokuWiki is a standards-compliant, simple-to-use wiki which allows users to create rich documentation repositories. It provides an environment for individuals, teams and companies to create and collaborate using a simple yet powerful syntax that ensures data files remain structured and readable outside the wiki."
  
 
"Unlimited page revisions allows restoration to any earlier page version, and with data stored in plain text files, no database is required. A powerful plugin architecture allows for extension and enhancement of the core system. See the features section for a full description of what DokuWiki has to offer."[http://wiki.splitbrain.org/wiki:dokuwiki]
 
"Unlimited page revisions allows restoration to any earlier page version, and with data stored in plain text files, no database is required. A powerful plugin architecture allows for extension and enhancement of the core system. See the features section for a full description of what DokuWiki has to offer."[http://wiki.splitbrain.org/wiki:dokuwiki]
  
In other words; docuwiki is a wiki written in php and requires no database.
+
In other words, DokuWiki is a wiki written in PHP and requires no database.
  
[http://wiki.splitbrain.org/wiki:dokuwiki Like to see a running example?]
+
[http://www.dokuwiki.org/ Like to see a running example?]
  
=== Initial Notes ===
+
== Initial Notes ==
 +
DokuWiki should work on any web server which supports PHP 5.1.2 or later.  As the requirements may change over time, you should consult the [http://www.dokuwiki.org/requirements requirements page] for DokuWiki for additional details.
  
The following guide sets up a dokuwiki under a directory beneath the html root.
+
It is strongly recommend to read through the appropriate sections of [http://www.dokuwiki.org/security DokuWiki's security page] for your web server.  Most popular web servers are covered but there are generic instructions as well.
  
If anyone would like to add a vhost setup guide please feel free to add it.
+
The package in [community] unpacks DokuWiki at {{ic|/usr/share/webapps/dokuwiki}} with the configuration files in {{ic|/etc/webapps/dokuwiki}} and the data files in {{ic|/var/lib/dokuwiki/data}}. It also changes the ownership of the relevant files to the "http" user. This should work fine for most popular web servers as packaged for Arch.
  
==== lighttp Notes ====
+
== Installation ==
  
lighttp creates its default directory under
+
# Install your web server of choice (e.g. [[Apache]], [[nginx]] or [[lighttpd]]) and configure it for [[PHP]].  As mentioned above, DokuWiki has no need for a database server so you may be able to skip those steps when setting up your web server.
  /home/lighttp
+
# Install {{Pkg|dokuwiki}} from [community] with [[pacman]].
The html root is located under
+
# Configure web server for dokuwiki (see section below)
  /home/lighttp/html/
+
# With your web browser of choice, open <nowiki>http://&lt;your-server&gt;/dokuwiki/install.php</nowiki> and continue the installation from there.
lighttp also creates (or uses) the user account and group of
+
  nobody:nobody
+
  
All of these settings can be changed in the file
+
Alternatively, if you would like to install from tarball, you can read from http://www.dokuwiki.org/Install.  Generally the procedure is the same as above.  Instead of using pacman, you will need to [http://www.splitbrain.org/projects/dokuwiki download the tarball], unpack it to your server's document root (e.g. {{ic|/srv/http/dokuwiki}}), and chown to the appropriate user (e.g. "http").
  /etc/lighttpd/lighttpd.conf
+
  
==== dokuwiki Notes ====
+
== Configuration ==
 +
If you are using [[lighttpd]] or [[nginx]] you need to adjust the {{ic|open_basedir}} in {{ic|/etc/php/php.ini}} to include the dokuwiki directories (php forbids following symbolic links outside of the allowed scope):
  
Some of the docuwiki plugins look to the root of the webserver rather than the root of the dokuwiki folder, which can cause some problems. All of the default plugins work with the following installation method.
+
{{hc|/etc/php/php.ini|<nowiki>
 +
open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/:/etc/webapps/dokuwiki/:/var/lib/dokuwiki/
 +
</nowiki>}}
  
== Installing lighttp ==
+
=== Apache ===
=== lighttp and fastcgi ===
+
Install [[Fastcgi and lighttpd]]
+
  #pacman -S lighttpd fcgi
+
Add an entry to your rc.conf
+
  DAEMONS=(syslog-ng network netfs crond '''lighttpd''')
+
Edit your /etc/hosts.allow (by adding the following line)
+
  lighttpd:    ALL
+
Start your webserver (''sanity check'')
+
  #/etc/rc.d/lighttpd start
+
Open a web browser to
+
  http://127.0.0.1/
+
You should see this:
+
  
<div style="text-align:center; font: 12px sans-serif;">
+
Firstly, create the file {{ic|/etc/httpd/conf/extra/dokuwiki.conf}} with the following contents:
    <span style="font-weight: bold; font-size: 20px;">
+
      Arch Linux
+
    </span>
+
    <br><br>
+
    This is a test page for the lighttpd Web Server.<br>
+
  </div>
+
  
Stop the webserver
+
{{bc|
  #/etc/rc.d/lighttpd stop
+
Alias /dokuwiki /usr/share/webapps/dokuwiki
 +
<Directory /usr/share/webapps/dokuwiki/>
 +
    Options +FollowSymLinks
 +
    AllowOverride All
 +
    order allow,deny
 +
    allow from all
 +
    php_admin_value open_basedir "/srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/:/etc/webapps/dokuwiki/:/var/lib/dokuwiki/"
 +
</Directory>
 +
}}
  
=== Configuration ===
+
Include the newly created file in the Apache configuration by placing the following line at the end of {{ic|/etc/httpd/conf/httpd.conf}}:
 +
{{bc|
 +
Include conf/extra/dokuwiki.conf
 +
}}
  
Uncomment these lines in /etc/lighttpd/lighttpd.conf
+
Make sure the folders {{ic|/etc/webapps/dokuwiki}} and {{ic|/var/lib/dokuwiki}} are owned by user and group "http". You may relocate these directories if you like as long as you update the references in {{ic|/etc/httpd/conf/extra/dokuwiki.conf}} respectively.
<pre>
+
"mod_fastcgi"
+
</pre>
+
<pre>
+
fastcgi.server            = ( ".php" =>
+
                              ( "localhost" =>
+
                                (
+
                                  "socket" => "/var/run/lighttpd/php-fastcgi.socket",
+
                                  "bin-path" => "/usr/bin/php-cgi"
+
                                )
+
                              )
+
                            )
+
</pre>
+
  
== Installing dokuwiki ==
+
Afterwards restart Apache:
=== Downloading the Latest Version ===
+
   # systemctl restart httpd.service
Go to [http://www.splitbrain.org/projects/dokuwiki dokuwiki] and get the latest version
+
   #mv dokuwiki*.tar.gz /home/lighttp/html
+
  cd /home/lighttp/html
+
  #tar xvf
+
  #mv dokuwiki-DATE dokuwiki
+
  
=== Preparing the Installation Files ===
+
Then finish the installation by running the ''dokuwiki/install.php'' script in your browser.
chown the dokuwiki files
+
  #chown -R nobody:nobody dokuwiki/
+
(nobody is the default user for lighttp, if you changed this, change the user:group to the lighttp user:group)
+
  
=== dokuwiki Specific lighttp Configuration ===
+
=== lighttpd Specific Configuration ===
  
Edit the /etc/lighthttpd/lighttpd.conf file
+
Edit the {{ic|/etc/lighttpd/lighttpd.conf}} file as per the [http://www.dokuwiki.org/install:lighttpd dokuwiki instructions] (might contain updated information).
 +
 
 +
Make sure the module {{ic|mod_access}} is loaded. If not, load it by adding the following to {{ic|/etc/lighttpd/lighttpd.conf}}:
 +
{{bc|1=
 +
server_modules += ("mod_access")
 +
}}
 +
{{ic|mod_access}} provides the {{ic|url.access-deny}} command, which we are using from this point.
  
 
Under the line:
 
Under the line:
<pre>
+
{{bc|1=
 
$HTTP["url"] =~ "\.pdf$" {
 
$HTTP["url"] =~ "\.pdf$" {
 
   server.range-requests = "disable"
 
   server.range-requests = "disable"
 
}
 
}
</pre>
+
}}
  
 
add this:  
 
add this:  
<pre>
+
{{bc|1=
 
# subdir of dokuwiki
 
# subdir of dokuwiki
 
# comprised of the subdir of the root dir where dokuwiki is installed
 
# comprised of the subdir of the root dir where dokuwiki is installed
Line 116: Line 95:
 
$HTTP["url"] =~ "^" + var.dokudir + "/inc/"  { url.access-deny = ( "" ) }
 
$HTTP["url"] =~ "^" + var.dokudir + "/inc/"  { url.access-deny = ( "" ) }
 
$HTTP["url"] =~ "^" + var.dokudir + "/conf/" { url.access-deny = ( "" ) }
 
$HTTP["url"] =~ "^" + var.dokudir + "/conf/" { url.access-deny = ( "" ) }
</pre>
+
}}
  
''These entries give some basic security to docuwiki.'' lighttpd does not use .htaccess files like apache. You CAN install with out this, but I would NEVER recommend it.  
+
''These entries give some basic security to DokuWiki.'' lighttpd does not use .htaccess files like Apache. You CAN install with out this, but I would NEVER recommend it.
  
For further (possibly updated) configuration, please see the [http://wiki.splitbrain.org/wiki:install:lighttpd dokuwiki install guide]
 
  
=== Restart lighttp ===
+
Add alias somewhere in lighttpd or fastcgi conf file:
Start your webserver
+
{{bc|1=
  #/etc/rc.d/lighttpd start
+
alias.url += ("/dokuwiki" => "/usr/share/webapps/dokuwiki/")
 +
}}
 +
The command {{ic|alias.url}} is provided by the module {{ic|mod_alias}} so that must be loaded for the above to work.
  
=== Install docuwiki ===
+
Restart lighttp:
Open a webbrowser to  
+
  # systemctl restart lighttpd
  http://127.0.0.1/dokuwiki/install.php
+
 
 +
=== nginx ===
 +
 
 +
Add the following location blocks to your {{ic|/etc/nginx/nginx.conf}}.
 +
 
 +
#Assuming that the root is set to /usr/share/webapps.
 +
#You may need to adjust your location blocks accordingly.
 +
location ~^/dokuwiki/(data|conf|bin|inc)/ { deny all; } # secure DokuWiki
 +
location ~^/dokuwiki/\.ht { deny all; } # also secure the Apache .htaccess files
 +
location ~^/dokuwiki/lib/^((?!php).)*$ { expires 30d; } # no need to serve non .php files through fastcgi, so we catch those requests here.
 +
location ~^/dokuwiki/.*\.php$ {
 +
            include fastcgi_params;
 +
            fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
 +
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 +
            fastcgi_param PATH_INFO $uri;
 +
        }
 +
 
 +
Restart nginx
 +
  # systemctl restart nginx
  
 
== Post Installation ==
 
== Post Installation ==
 
=== Cleaning Up ===
 
=== Cleaning Up ===
 
'''After configuring the server remove the install.php file!'''
 
'''After configuring the server remove the install.php file!'''
   #rm install.php
+
   # rm /srv/http/dokuwiki/install.php
  
 
=== Installing Plugins ===
 
=== Installing Plugins ===
 +
Many community created plugins can be found [http://www.dokuwiki.org/plugins here]
  
Many community created plugins can be found [http://wiki.splitbrain.org/wiki:plugins here]
+
They can be added through the web interface (as well as updated) through the Admin menu. Some plugins cannot be downloaded, if they go over ssl (e.g. git). Uncomment following line in {{ic|/etc/php/php.ini}}:
 
+
{{bc|1=
They can be added through the web interface (as well as updated) through the Admin menu.
+
extension=openssl.so
 +
}}
  
 
=== Backing Up ===
 
=== Backing Up ===
It is very trivial to backup docuwiki, since there is no database. All pages are in plain text, and require only a simple tar, or rsync.  
+
It is very trivial to backup DokuWiki, since there is no database. All pages are in plain text, and require only a simple tar, or rsync.  
  
 
A quick breakdown of the directories of interest in the current (2008-05-05) version:
 
A quick breakdown of the directories of interest in the current (2008-05-05) version:
   /docuwiki/data/  =>  All User Created Data
+
   /dokuwiki/data/  =>  All User Created Data
   /docuwiki/lib/plugins/  =>  All User Added Plugins
+
   /dokuwiki/lib/plugins/  =>  All User Added Plugins
  
 
== Further Reading ==
 
== Further Reading ==
  
The dokuwiki [http://wiki.splitbrain.org/wiki:dokuwiki main site] has all of the information and help that you could possibly need.
+
The [http://www.dokuwiki.org/ DokuWiki main site] has all of the information and help that you could possibly need.

Revision as of 21:12, 30 January 2014

"DokuWiki is a standards-compliant, simple-to-use wiki which allows users to create rich documentation repositories. It provides an environment for individuals, teams and companies to create and collaborate using a simple yet powerful syntax that ensures data files remain structured and readable outside the wiki."

"Unlimited page revisions allows restoration to any earlier page version, and with data stored in plain text files, no database is required. A powerful plugin architecture allows for extension and enhancement of the core system. See the features section for a full description of what DokuWiki has to offer."[1]

In other words, DokuWiki is a wiki written in PHP and requires no database.

Like to see a running example?

Initial Notes

DokuWiki should work on any web server which supports PHP 5.1.2 or later. As the requirements may change over time, you should consult the requirements page for DokuWiki for additional details.

It is strongly recommend to read through the appropriate sections of DokuWiki's security page for your web server. Most popular web servers are covered but there are generic instructions as well.

The package in [community] unpacks DokuWiki at /usr/share/webapps/dokuwiki with the configuration files in /etc/webapps/dokuwiki and the data files in /var/lib/dokuwiki/data. It also changes the ownership of the relevant files to the "http" user. This should work fine for most popular web servers as packaged for Arch.

Installation

  1. Install your web server of choice (e.g. Apache, nginx or lighttpd) and configure it for PHP. As mentioned above, DokuWiki has no need for a database server so you may be able to skip those steps when setting up your web server.
  2. Install dokuwiki from [community] with pacman.
  3. Configure web server for dokuwiki (see section below)
  4. With your web browser of choice, open http://<your-server>/dokuwiki/install.php and continue the installation from there.

Alternatively, if you would like to install from tarball, you can read from http://www.dokuwiki.org/Install. Generally the procedure is the same as above. Instead of using pacman, you will need to download the tarball, unpack it to your server's document root (e.g. /srv/http/dokuwiki), and chown to the appropriate user (e.g. "http").

Configuration

If you are using lighttpd or nginx you need to adjust the open_basedir in /etc/php/php.ini to include the dokuwiki directories (php forbids following symbolic links outside of the allowed scope):

/etc/php/php.ini
open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/:/etc/webapps/dokuwiki/:/var/lib/dokuwiki/

Apache

Firstly, create the file /etc/httpd/conf/extra/dokuwiki.conf with the following contents:

Alias /dokuwiki /usr/share/webapps/dokuwiki
<Directory /usr/share/webapps/dokuwiki/>
    Options +FollowSymLinks
    AllowOverride All
    order allow,deny
    allow from all
    php_admin_value open_basedir "/srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/:/etc/webapps/dokuwiki/:/var/lib/dokuwiki/"
</Directory>

Include the newly created file in the Apache configuration by placing the following line at the end of /etc/httpd/conf/httpd.conf:

Include conf/extra/dokuwiki.conf

Make sure the folders /etc/webapps/dokuwiki and /var/lib/dokuwiki are owned by user and group "http". You may relocate these directories if you like as long as you update the references in /etc/httpd/conf/extra/dokuwiki.conf respectively.

Afterwards restart Apache:

 # systemctl restart httpd.service

Then finish the installation by running the dokuwiki/install.php script in your browser.

lighttpd Specific Configuration

Edit the /etc/lighttpd/lighttpd.conf file as per the dokuwiki instructions (might contain updated information).

Make sure the module mod_access is loaded. If not, load it by adding the following to /etc/lighttpd/lighttpd.conf:

server_modules += ("mod_access")

mod_access provides the url.access-deny command, which we are using from this point.

Under the line:

$HTTP["url"] =~ "\.pdf$" {
  server.range-requests = "disable"
}

add this:

# subdir of dokuwiki
# comprised of the subdir of the root dir where dokuwiki is installed
# in this case the root dir is the basedir plus /htdocs/
# Note: be careful with trailing slashes when uniting strings.
# all content on this example server is served from htdocs/ up.
#var.dokudir = var.basedir + "/dokuwiki"
var.dokudir = server.document-root + "/dokuwiki"

# make sure those are always served through fastcgi and never as static files
# deny access completly to these
$HTTP["url"] =~ "/\.ht" { url.access-deny = ( "" ) }
$HTTP["url"] =~ "/_ht" { url.access-deny = ( "" ) }
$HTTP["url"] =~ "^" + var.dokudir + "/bin/"  { url.access-deny = ( "" ) }
$HTTP["url"] =~ "^" + var.dokudir + "/data/" { url.access-deny = ( "" ) }
$HTTP["url"] =~ "^" + var.dokudir + "/inc/"  { url.access-deny = ( "" ) }
$HTTP["url"] =~ "^" + var.dokudir + "/conf/" { url.access-deny = ( "" ) }

These entries give some basic security to DokuWiki. lighttpd does not use .htaccess files like Apache. You CAN install with out this, but I would NEVER recommend it.


Add alias somewhere in lighttpd or fastcgi conf file:

alias.url += ("/dokuwiki" => "/usr/share/webapps/dokuwiki/")

The command alias.url is provided by the module mod_alias so that must be loaded for the above to work.

Restart lighttp:

 # systemctl restart lighttpd

nginx

Add the following location blocks to your /etc/nginx/nginx.conf.

#Assuming that the root is set to /usr/share/webapps.
#You may need to adjust your location blocks accordingly.
location ~^/dokuwiki/(data|conf|bin|inc)/ { deny all; } # secure DokuWiki
location ~^/dokuwiki/\.ht { deny all; } # also secure the Apache .htaccess files
location ~^/dokuwiki/lib/^((?!php).)*$ { expires 30d; } # no need to serve non .php files through fastcgi, so we catch those requests here.
location ~^/dokuwiki/.*\.php$ {
            include fastcgi_params;
            fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param PATH_INFO $uri;
        }

Restart nginx

 # systemctl restart nginx

Post Installation

Cleaning Up

After configuring the server remove the install.php file!

 # rm /srv/http/dokuwiki/install.php

Installing Plugins

Many community created plugins can be found here

They can be added through the web interface (as well as updated) through the Admin menu. Some plugins cannot be downloaded, if they go over ssl (e.g. git). Uncomment following line in /etc/php/php.ini:

extension=openssl.so

Backing Up

It is very trivial to backup DokuWiki, since there is no database. All pages are in plain text, and require only a simple tar, or rsync.

A quick breakdown of the directories of interest in the current (2008-05-05) version:

 /dokuwiki/data/  =>  All User Created Data
 /dokuwiki/lib/plugins/  =>  All User Added Plugins

Further Reading

The DokuWiki main site has all of the information and help that you could possibly need.