قالب وردپرس درنا توس
Home / How To / How to install DokuWiki with Nginx and let's encrypt SSL on Debian 10

How to install DokuWiki with Nginx and let's encrypt SSL on Debian 10



DokuWiki is an easy-to-use and highly versatile Open Source wiki software that does not require a database. It is loved by users for its clean and readable syntax . Easy maintenance, backup and integration make it the administrator's favorite. Built-in access controls and authentication connections make DokuWiki particularly useful in a corporate context and a large number of plugins have contributed to its lively community enabling a wide range of uses beyond a wide range of uses. This tutorial shows you how to install DokuWiki on a new Debian 10 (buster) server.

Requirements

Make sure your server meets the following requirements.

  • Web server software that supports PHP (Apache, NGINX, IIS, Lighttpd, LiteSpeed)
  • PHP version 5.6 or later, newer versions are highly recommended.

Prerequisites

  • Debian 1
    0 (buster) operating system.
  • A non-root user with sudo privileges.

Initial steps

Check your Debian version:

  lsb_release -ds 
# Debian GNU / Linux 10 (buster)

Set time zone:

  sudo dpkg-reconfigure tzdata 

Update your operating system packages (software). This is an important first step as it ensures that you have the latest updates and security fixes for your operating system's standard software packages:

  sudo apt update && sudo apt upgrade -y 

Install some important packages necessary for basic administration of the Debian operating system :

  sudo apt install -y curl wget vim git unzip socat bash-finishing apt-transport-https 

Step 1 – Install PHP and PHP extensions

Install PHP and necessary PHP extensions: [19659011] sudo apt install -y php7.3 php7.3-cli php7.3-fpm php7.3-gd php7.3-xml php7.3-zip

To view PHP compiled in modules, you can run: [19659011] php -m

ctype
curl
exif
fileinfo
. . .
. . .

Check PHP version:

  php --version 

# PHP 7.3.9-1 (cli) (built: April 13, 2019 19:05:48) (NTS)
# Copyright (c) 1997-2018 PHP Group
# Zend Engine v3.3.4, Copyright (c) 1998-2018 Zend Technologies
# with Zend OPcache v7.3.4-2, Copyright (c) 1999- 2018, by Zend Technologies

PHP-FPM service is automatically started and activated upon restarting the Debian 10 system, so there is no need to start and activate it manually. We can move on to the next step where we will install the acme.sh client and get SSL certificates.

Step 2 – Install the acme.sh client and obtain Let & # 39; s Encrypt certificate (optional)

Securing your website with HTTPS is not necessary, but it is a good practice to secure your website traffic. To get a TLS certificate from Let & # 39; s Encrypt, we will use the acme.sh client. Acme.sh is a simple UNIX shell software to obtain TLS certificates from Let & # 39; s Encrypt with zero dependencies.

Download and install acme.sh:ebrit19659011??sudo su – root
git clone https://github.com/ Neilpang / acme.sh.git
cd acme.sh
./ acme.sh – install –accountemail [email protected] source ~ / .bashrc
cd ~

Check acme.sh version:

  acme.sh --version 
# v2.8.2

Obtain RSA and ECC / ECDSA certificate for your domain / host name:

  # RSA 2048 
acme.sh - emission - standalone -d example.com --keylength 2048
# ECDSA
acme.sh - issue - standalone -d example .com - key length ec-256

If you want fake certificates for testing, you can add - Staging flag for the commands above.

After running the above commands, certificate and keys will be in:

  • For [1 9459022] RSA : / home / usname / example.com directory.
  • For ECC / ECDSA : /home/username/example.com_ecc directory.

To list your issued certificates, you can run:

  acme.sh --list 

Create a directory to store your certificates. We will use the / etc / letsencrypt directory.

  mkdir -p /etc/letsecnrypt/example.com Chapter19659043vardsudo mkdir -p /etc/letsencrypt/example.com_eccebrit19659012 ch an19459026] Install / copy certificate to    / etc / letsencrypt 

.

  # RSA 
acme.sh --install-cert -d example.com --cert-file / etc / letsencrypt / example.com / cert.pem --key-file /etc/letsencrypt/example.com/private.key --fullchain-file /etc/letsencrypt/example.com/fullchain.pem --reloadcmd "sudo systemctl reload nginx.service "
# ECC / ECDSA
acme.sh --install-cert -d example. com --ecc --cert-file /etc/letsencrypt/example.com_ecc/cert.pem --key-file /etc/letsencrypt/example.com_ecc/private.key --fullchain-file / etc / letsencrypt / example. com_ecc / fullchain.pem --reloadcmd "sudo systemctl reload nginx.service"

All certificates are automatically renewed every 60 days.

After getting certificate exit from root user and returning to normal sudo user:

  exit 

Step 3 - Install and configure Nginx

DokuWiki will run on any web server that supports PHP. In this tutorial we will use Nginx. If you prefer Apache or another web server, you can use it instead of Nginx.

Download and install NGINX from Debian layer:

  sudo apt install -y nginx 

Check Nginx version:

  sudo nginx -v 
# nginx version: nginx / 1.14.2

Configure Nginx:

  sudo vim /etc/nginx/sites-available/dokuwiki.conf Chapter19659012PGCopy / paste the following Nginx configuration and save it: 

  server {

listen [::] : 443 ssl;
listen 443 ssl; listen [::]: 80; listen 80; # RSA
ssl_certificate /etc/letsencrypt/example.com/fullchain.pem; Greece 19459018 Primary search_certificate_key /etc/letsencrypt/example.com/private.key;?19199198## ECC
ssl_certificate_ec lets the example / fullchain.pem;
ssl_certificate_key /etc/letsencrypt/example.com_ecc/private.key;ebrit19459018] server name wiki.example.com; root / var / www / dokuwiki; index index.html index.htm index.php doku.php; client_max_body_size 15M; client_body_buffer_size 128K; location / { try_files $ uri $ uri / @dokuwiki; } location ^ ~ / conf / {return 403; } location ^ ~ / data / {return 403; } place ~ /.ht {deny all; } location @dokuwiki { write about ^ / _ media /(.*) /lib/exe/fetch.php?media=$1 last; write about ^ / _ detail /(.*) /lib/exe/detail.php?media=$1 last; write about ^ / _ export / ([^/] +) / (. *) /doku.php?do=export_$1&id=$2 last; write about ^ / (. *) /doku.php?id=$1 last; } location ~ .php $ { try_files $ uri = 404; fastcgi_pass unix: /var/run/php/php7.3-fpm.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name; } }

Enable the new dokuwiki.conf configuration by linking the file to the sites-enabled directory:

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

Check the Nginx configuration:

  sudo nginx -t 

Reload Nginx:

  sudo systemctl reload nginx.service 

Step 4 - Install DokuWiki

Create a document root directory:

  sudo mkdir -p / var / www / dokuwiki 

Navigate to the document root:

  cd / var / www / dokuwiki 

Download the latest stable release by DokuWiki from the DokuWiki download page:

  sudo wget https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgzebrit19659012₂Unpack DokuWiki tarball: 

  sudo tar xvf dokuwiki-stable. tgz 
sudo rm dokuwiki-stable.tgz
sudo etc. dokuwiki-2018-04-22b / *. && mv dokuwiki-2018-04-22b /.*.
sudo rmdir dokuwiki-2018-04-22b /

Change ownership of directory / var / www / dokuwiki to www-data:

  sudo chown -R www-data: www-data / var / www / dokuwiki 

Restart php7.3-fpm.service:

  sudo systemctl restart php7.3-fpm.service 

Open install script for DokuWiki, install.php in your browser and configure DokuWiki. The installation script checks the availability of the necessary PHP functions and checks for file permissions as needed. It also creates an initial administrator account and an initial ACL policy. To run the installer, open http://wiki.example.com/install.php in the browser and follow the instructions.

Step 5 - Access the DokuWiki Web Interface

Open your web browser and type the URL http://example.com/install.php. You will be redirected to the following page:

  DikuWiki installer

Enter all necessary information such as super user name, email address, password. Then click on the button Save . When the installation is complete, see the following page:

  Set username and password

Now, click on your new DokuWiki . You should see the following page:

  DokuWiki has been installed

Now, click the login button. You will be redirected to the following page:

  Login

Now enter your username and password. Then click Log In the button. You should see the DokuWiki dashboard on the following page:

  Welcome to DokuWiki

After successful configuration, remove the install.php file from the DokuWiki root directory:

  sudo rm /var/www/dokuwiki/install.phpebrit19659012s Congratulations! You have installed and configured DokuWiki on the Debian 10 server. You can now create your own wiki site using DokuWiki. 


Source link