By Arslan Ud Din Shafiq, Alibaba Cloud Tech Share Author. Tech Share is Alibaba Cloud's incentive program to encourage the sharing of technical knowledge and best practices within the cloud community.
DokuWiki is an open source wiki software that lets you build a collaborative app easily. DokuWiki is popular due to its readable syntax, and is also liked by website administrators because it is easy to maintain, manage, backup and integrate.
In this tutorial, we will be installing and setting up DokuWiki using Alibaba Cloud Elastic Compute Service (ECS) with Ubuntu 16.04 installed.
In this tutorial, I will be using Alibaba Cloud Elastic Compute Service (ECS) with Ubuntu 16.04 installed on it.
Before proceeding with installation of any kind of package, use the following command to update your Ubuntu system. To execute this command, remember to login from non-root user with sudo privileges. After execution of this command, you will be prompted to Is this ok? Type 'Y' and hit Enter.
Step 1:
# sudo apt update && sudo apt upgrade
DokuWiki requires atleast installation of PHP 5.6 or newer version of PHP. In this tutorial, you will install PHP 7.2. To install PHP 7.2, execute the following steps.
Install python software properties and software properties common. To do so, execute the command below.
# sudo apt-get install software-properties-common python-software-properties
You will need to add repository for newer versions of PHP. To do so, execute the commands below.
# sudo add-apt-repository ppa:ondrej/php
Update the package to refresh the available repositories. To do so, execute the command for updating Ubuntu system.
# sudo apt update
Install PHP 7.2. To install PHP 7.2, execute the following command.
# sudo apt install -y php7.2
DokuWiki requires the following PHP extensions:
To install the above extensions of PHP, execute the following command.
# sudo apt install -y php7.2-cli php7.2-fpm php7.2-xml php7.2-gd php7.2-zip
To check PHP installation, you can execute the following command to check installed PHP version.
# php --version
Before starting installation of Nginx server, you will need to stop apache service. To do so, execute the command below.
# sudo systemctl stop apache2
Execute the command below to install Nginx server.
# sudo apt-get install nginx
Now start Nginx server by executing command below.
# sudo systemctl start nginx
To check installation of Nginx server, you can execute the following command.
# sudo nginx -v
Create Nginx configuration file for DokuWiki. Execute the following command, a file will be opened in nano text editor.
# sudo nano /etc/nginx/sites-available/doku.conf
Copy and paste the following code and save the file.
server {
listen 80;
listen [::]:80;
server_name softpedia.xyz;
return 301 https://$server_name$request_uri;
}
server {
listen [::]:443 ssl;
listen 443 ssl;
server_name softpedia.xyz;
ssl_certificate /etc/letsencrypt/live/softpedia.xyz/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/softpedia.xyz/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
# Maximum file upload size is 4MB - change accordingly if needed
client_max_body_size 4M;
client_body_buffer_size 128k;
root /var/www/dokuwiki;
index doku.php index.html index.htm index.php;
#Remember to comment the below out when you're installing, and uncomment it when done.
location ~ /(data/|conf/|bin/|inc/|install.php) { deny all; }
# Uncomment this prevents images being displayed !
# location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
# expires 31536000s;
# add_header Pragma "public";
# add_header Cache-Control "max-age=31536000, public, must-revalidate, proxy-revalidate";
# log_not_found off;
# }
location / { try_files $uri $uri/ @dokuwiki; }
location @dokuwiki {
# rewrites "doku.php/" out of the URLs if you set the userewrite setting to .htaccess in dokuwiki config page
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$ {
try_files $uri $uri/ /doku.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param REDIRECT_STATUS 200;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}
}
Now create symlink of newly created file's configuration to enabled-sites directory. To do so, execute the command below.
# sudo ln -s /etc/nginx/sites-available/doku.conf /etc/nginx/sites-enabled/
Now execute the following command to test the syntax of Nginx configuration file.
# sudo nginx -t
Execute the following command to reload the updated configurations.
# sudo systemctl reload nginx
To install and configure DokuWiki, follow the steps below.
Navigate to root document directory.
# cd /var/www
Now download the files of DokuWiki from the DokuWiki official website by executing commands below.
# sudo wget https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz
Extract the files from downloaded directory by executing command below.
# sudo tar xvf dokuwiki-stable.tgz
Now rename the extracted directory to dokuwiki using the command below.
# sudo mv /var/www/dokuwiki-2018-04-22a /var/www/dokuwiki
Navigate to /var/www/DokuWiki
# cd dokuwiki
Now change the ownership of newly created directory to your username.
# sudo chown -R www-data:www-data /var/www/dokuwiki
You will use Let's Encrypt Certbot to install free SSL certificate. Certbot team maintains a PPA for Let's Encrypt.
Update the package by executing command below.
# sudo apt-get update
Now you will need to install software-properties-common by executing command below.
# sudo apt-get install software-properties-common
Now add the certbot PPA to repository using the command below.
# sudo add-apt-repository ppa:certbot/certbot
Now update the package again by executing command below.
# sudo apt-get update
Install python-certbot-nginx by executing command below.
# sudo apt-get install python-certbot-nginx
To get Let's Encrypt SSL issued for your domain, execute the command below. Remember to change softpedia.xyz with your own domain name.
# sudo certbot --nginx -d softpedia.xyz
Restart php7.2-fpm service by executing the command below.
# sudo systemctl restart php7.2-fpm.service
Reload nginx server to load all settings.
# sudo systemctl reload nginx
Now you can access DokuWiki via ECS IP address or your domain name. In my case, I have setup domain. After accessing DokuWiki, you will be redirected to the following page.
You will have to make few changes to make DokuWiki work correctly. To do so, follow the steps below.
Navigate to link https://your_domain_name/install.php or http://your_ip_address/install.php
Remember, in case, you don't have any domain registered, you may buy it from Alibaba Cloud. Otherwise, you will have to skip SSL installation section to avoid errors. In case of using IP address of ECS, you will have to update nginx configuration in doku.conf file.
Select you desired language. DokuWiki supports more than 50 languages.
Fill the following form and save it.
You will see the following screen which shows the configuration was finished successfully.
To continue to your new DokuWiki, you are recommended to delete install.php file from your Alibaba Cloud ECS instance.
It is important to remove install.php file to avoid security related problems in future. To do so, follow the steps below.
Connect to your ECS shell via Putty or console and login.
Navigate to /var/www/dokuwiki using the command below.
# cd /var/www/dokuwiki
Execute the following command to see either you are in right folder or not.
# ls -li
Now execute the following command to remove install.php file.
# sudo rm install.php
To confirm that either the file has been deleted successfully or not, execute the command below.
# ls -li
You can see in the following screen, there is no file named install.php which means the file has been deleted successfully.
Now you can navigate to https://your_domain_name/doku.php?id=wiki:welcome , you will see the following screen.
That's it! Your DokuWiki is ready to use.
Alibaba Cloud Link Vision Video Service: An IoT Solution for the Security Industry
2,599 posts | 764 followers
FollowAlibaba Cloud Community - December 4, 2023
Alibaba Cloud Community - July 3, 2024
Alibaba Clouder - December 3, 2019
Alibaba Clouder - November 27, 2018
Alibaba Clouder - January 17, 2019
Alibaba Clouder - December 3, 2019
2,599 posts | 764 followers
FollowElastic and secure virtual cloud servers to cater all your cloud hosting needs.
Learn MoreAn encrypted and secure cloud storage service which stores, processes and accesses massive amounts of data from anywhere in the world
Learn MoreLearn More
More Posts by Alibaba Clouder