Atlantic.Net Blog

How to Install DokuWiki with Nginx on Debian 10

Hitesh Jethva
by Atlantic.Net (243 posts) under Dedicated Server Hosting, Tutorials
0 Comments

DokuWiki is one of the most popular wiki applications written in PHP. It is a file-based wiki so you don’t need to install any database system to your system. DokuWiki allows you to create your own wiki site without any advanced knowledge. It offers very useful features such as multiple language support, SEO, authentication, spam blacklist, autosave, read-only pages, simple and lightweight architecture, and more. It is used by small companies to manage information and build knowledge bases.

In this post, we will explain how to install DokuWiki with Nginx on Debian 10.

Prerequisites

  • A fresh Debian 10 server on the Atlantic.Net Cloud Platform
  • A root password configured on your server

Step 1 – Create Atlantic.Net Cloud Server

First, log in to your Atlantic.Net Cloud Server. Create a new server, choosing Debian 10 as the operating system with at least 2GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.

Once you are logged in to your Debian 10 server, run the following command to update your base system with the latest available packages.

apt-get update -y

Step 2 – Install Nginx and PHP

First, you will need to install the Nginx web server, PHP, and other PHP extensions to your server. You can install all of them with the following command:

apt-get install nginx php php-fpm php-curl php-gd php-opcache php-json php-mbstring php-intl php-imagick php-xml -y

The above command will also install the Apache package and start the Apache service, so you will need to remove the Apache from your system.

Run the following command to remove the Apache package and stop the service.

systemctl stop apahce2
apt-get remove apache2 --purge

Next, start the Nginx and PHP-FPM service with the following command:

systemctl start nginx
systemctl start php7.3-fpm

Step 3 – Download DokuWiki

Next, go to the DokuWiki download page, pick the latest version of DokuWiki, and download it with the following command:

cd /var/www/html
wget https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz

After downloading, extract the downloaded file with the following command:

tar -xvzf dokuwiki-stable.tgz

Next, move the extracted directory to DokuWiki with the following command:

mv dokuwiki-2020-07-29 dokuwiki

Next, give proper permissions and ownership to the DokuWiki directory:

chown -R www-data:www-data /var/www/html/dokuwiki
chmod -R 755 /var/www/html/dokuwiki

Step 4 – Configure Nginx for DokuWiki

Next, create an Nginx virtual host configuration file for DokuWiki:

nano /etc/nginx/sites-available/dokuwiki.conf

Add the following lines:

server {
    listen 80;
    server_name doku.example.com;
    root /var/www/html/dokuwiki;
    index index.php index.html index.html;

 
    location / { 
        try_files $uri $uri/ @dokuwiki;
    }
  
    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$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

Save and close the file, then activate the Nginx virtual host and verify Nginx with the following command:

ln -s /etc/nginx/sites-available/dokuwiki.conf /etc/nginx/sites-enabled/
nginx -t

Output:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful

If you experience this issue:

nginx: [emerg] could not build server_names_hash

You should increase server_names_hash_bucket_size: 32 and edit the /etc/nginx.conf file to read:

server_names_hash_bucket_size 64;

Next, restart the Nginx service to apply the changes:

systemctl restart nginx

Step 5 – Access DokuWiki Installation

Now, open your web browser and access the DokuWiki installation using the URL http://doku.example.com/install.php. You should see the following screen:
Dokuwiki welcome page
Provide your Wiki name, admin username, password, and email and click on the Save button. You should see the following screen:
Dokuwiki installation complete page
Click on your new DokuWiki. You will be redirected to the DokuWiki welcome screen:
Dokuwiki welcome screen
Click on the Log In button. You should see the DokuWiki login screen:
Dokuwiki Login screen
Provide your admin username, password and click on the Log In button. You should see the DokuWiki dashboard on the following screen:
Dokuwiki Dashboard

Conclusion

In the above guide, you learned how to install DokuWiki with Nginx on Debian 10 server. You can now use the DokuWiki to store your documentation and other information. Get started with DokuWiki on dedicated server hosting from Atlantic.Net!

Get A Free To Use Cloud VPS

Free Tier Includes:
G3.2GB Cloud VPS Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


Looking for a Hosting Solution?

We Provide Cloud, Dedicated, & Colocation.

  • Seven Global Data Center Locations.
  • Flexible Private, Public, & Hybrid Hosting.
  • 24x7x365 Security, Support, & Monitoring.
Contact Us Now! Med Tech Award FTC
SOC Audit HIPAA Audit HITECH Audit

Recent Posts

Get started with 12 months of free cloud VPS hosting

Free Tier includes:
G3.2GB Cloud VPS Server Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


New York, NY

100 Delawanna Ave, Suite 1

Clifton, NJ 07014

United States

San Francisco, CA

2820 Northwestern Pkwy,

Santa Clara, CA 95051

United States

Dallas, TX

2323 Bryan Street,

Dallas, Texas 75201

United States

Ashburn, VA

1807 Michael Faraday Ct,

Reston, VA 20190

United States

Orlando, FL

440 W Kennedy Blvd, Suite 3

Orlando, FL 32810

United States

Toronto, Canada

20 Pullman Ct, Scarborough,

Ontario M1X 1E4

Canada

London, UK

14 Liverpool Road, Slough,

Berkshire SL1 4QZ

United Kingdom

Resources