Installing DokuWiki , nginx, PHP on Ubuntu 14.04 64

A wiki allows you to organize and present documentation without the overhead of a complex system.

DokuWiki is free, open source, and requires very little out of a server. Using a very familiar interface, it allows you to easily scale and optimize using many advanced features. Utilizing files instead of a database, DokuWiki is extremely flexible with the type of system it will run on (no database server required).


For these instructions, we will be installing and configuring nginx and php. Additionally, will download and configure DokuWiki.

The instructions were verified on InterServer`s OpenVZ VPS Hosting service, utilizing Ubuntu 14.04 64-bit minimal version.

Requirements:

  • Tested on InterServer’s OpenVZ VPS Hosting with Ubuntu 14.04 64-bit (instructions are for minimal distribution, but should work for regular distribution as well).
  • Putty or similar SSH client
  • root login and password or an account capable of sudo
  • nano or similar text editor installed on the server.
  • Make sure Apache is not installed (they can co-exist, with Apache behind nginx, however, that is out of scope with these instructions).

Installation

First, will run an update:

  • sudo apt-get update

Install nginx:

  • sudo apt-get install nginx

Verify the server installed

Using your web browser, type the URL or IP Address of your server. If your site does not come up with the name, this could indicate a DNS issue, so try the IP address that was listed in your welcome email from your host, instead.

You should see this screen:

Install PHP

Will install php5-fpm (FastCGI Process Manager) and php5-gd:

  • sudo apt-get install php5-fpm php5-gd

We need to configure a few things for everything to work correctly:

First, will configure fpm:

  • sudo nano /etc/php5/fpm/php.ini

There is a potential security problem with one of the settings. If a script is not found, a similarly named script may be executed. This requirement is also documented in /etc/nginx/sites-available/default, which will work on in the next step. Let's make the change:

We are trying to find a line that says: ;cgi.fix_pathinfo=1. We can find it by hitting Ctrl-W and searching for cgi.fix.

We will remove the semicolon (if present), and change it to:

  • cgi.fix_pathinfo=0
  • ctrl-x and y will save the file.

Restart PHP FPM:

  • sudo service php5-fpm restart

At the moment, we have nginx installed, php-fpm is configured. We just need to finish nginx so everything is connected.

Let's open the sites-available/default file (if you already have nginx installed from before, the file may be called yourdomain.com):

sudo nano /etc/nginx/sites-available/default

Make the following changes:

Find the line that says: index index.html index.htm; and change it to:

  • index index.php index.html index.htm;

Find the line that says: server_name localhost; and change it to:

  • server_name yourdomain.com_or_IP;

There is also some functionality that is currently disabled with a # and we want to change that. Let's enable them by erasing the #:

#error_page 404 /404.html;

#error_page 500 502 503 504 /50x.html;

#location = /50x.html {

# root /usr/share/nginx/html;

#}

A few more:

#location ~ .php$ {

# fastcgisplitpath_info ^(.+.php)(/.+)$;

# fastcgi_pass unix:/var/run/php5-fpm.sock;

# fastcgi_index index.php;

# include fastcgi_params;

#}

ctrl-x and y will save the file.

Restart nginx, so the changes take effect:

sudo service nginx restart

Let’s test, to make sure everything is working. Will create a php file with a single command to show us PHP and nginx are working:

  • sudo nano /usr/share/nginx/html/test.php

Will use phpinfo() to show our configuration. Write the following line:

  • <?php phpinfo(); ?>
  • Close out and save Ctrl-X and y

Use your browser to view test.php (yourdomain.com/test.php, or yourip/test.php)

  • If you received the same page as the picture above, your server is ready.

Let’s clean up the file we created for testing:

  • sudo rm /usr/share/nginx/html/test.php

Install DokuWiki

First will go to our home directory for download:

  • cd ~

Download DokuWiki:

  • sudo wget http://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz

Unpack it:

  • sudo tar xzvf dokuwiki-stable.tgz

Clean up:

  • sudo rm dokuwiki-stable.tgz

Move the directory so nginx can see it:

  • sudo mv dok* /usr/share/nginx/html/wiki

Let's set owners so nginx can write into our wiki:

  • sudo chown -R www-data /usr/share/nginx/html/wiki/data
  • sudo chown www-data /usr/share/nginx/html/wiki/lib/plugins/
  • sudo chown www-data /usr/share/nginx/html/wiki/conf

Everything is installed and configured on the command line side. Let's go to our browser and finish our configurations:

  • Visit yourdomain.com/wiki/install.php

  • Configure the Wiki, with your login, password, etc.
  • Select the type of public powers you want to grant.

  • We are done configuring. Follow the links on the page to learn how to customize DokuWiki.

Let's clean up:

  • sudo rm /usr/share/nginx/html/wiki/install.php

This website is supported by our affiliation with web hosting companies. We encourage you to visit our friends at Interserver. They really do offer $6 per month VPS Hosting. Linux, windows and cpanel available, have fast service, and caring customer service!

See more articles in: Instructions, Videos, Ubuntu, nginx, wiki

comments powered by Disqus