Installing nginx if it’s not installed

  1. First, update the repo to get latest versions

    sudo apt update
    
  2. Install nginx

    sudo apt install nginx (you can ignore this step if you ran it above for the above install)
    
  3. Enable the service to start on boot

    sudo systemctl enable nginx
    

Install PHP

  1. Update the repo to get latest versions

    sudo apt update
    
  2. Install php and php extensions

    sudo apt install php7.2 php7.2-mysql php7.2-gd php7.2-mbstring php7.2-common php7.2-opcache php7.2-cli php7.2-xml
    

Installing MariaDB

  1. First, update the repo to get latest versions (you can ignore this step if you ran it above for the above installs)

    sudo apt update
    
  2. Install Maridadb-server and mariadb-client

    sudo apt install mariadb-server mariadb-client
    
  3. Secure the installation

    sudo mysql_secure_installation
    
  4. First will prompt you for current password, this will be blank so just press enter

    Enter current password for root (enter for none): 
    
  5. Next, it will ask you to set a root password. Press Y and enter a password, and then confirm.

    Set root password? [Y/n] Y
    
  6. The rest, accept the defaults, and complete the configuration.

  7. Enable the service to start on boot.

    sudo systemctl enable mariadb-server
    

Setting up database for Kanboard

  1. Login to mysql, this was prompt you for your password you set earlier.

    sudo mysql -u root -p
    
  2. Create database

    CREATE DATABASE kanboard CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    
  3. Create a user (Please change the password at the end to a secure password)

    create user 'kanboarduser'@'localhost' identified by 'your-password';
    
  4. Grant privileges to the above account

    grant all privileges ON kanboard.* TO 'kanboarduser'@'localhost';
    
  5. Flush privileges and exit

    flush privileges;
    exit;       
    

Installing Kanboard

  1. Download the latest release

    git clone https://github.com/kanboard/kanboard.git
    
  2. Move to the nginx directory

    sudo mv kanboard /usr/share/nginx/kanboard
    
  3. Amend permissions of the folder

    sudo chown www-data:www-data /usr/share/nginx/kanboard/data -R
    
  4. Create the nginx config file

    sudo nano /etc/nginx/conf.d/kanboard.conf
    
  5. Copy and paste the below into the file for the config. Change the server_name to your server name/IP. If you want to change the port too, change the listen 80 line.

    server {
     listen       80;       
     server_name  kan.example.com;
     index        index.php;
     root         /usr/share/nginx/kanboard;
     client_max_body_size 32M;
    
     location / {
         try_files $uri $uri/ /index.php$is_args$args;
     }
    
     location ~ \.php$ {
         try_files $uri =404;
         fastcgi_split_path_info ^(.+\.php)(/.+)$;
         fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
         fastcgi_index index.php;
         include fastcgi_params;
     }
    
     location ~* ^.+\.(log|sqlite)$ {
         return 404;
     }
    
     location ~ /\.ht {
         return 404;
     }
    
     location ~* ^.+\.(ico|jpg|gif|png|css|js|svg|eot|ttf|woff|woff2|otf)$ {
         log_not_found off;
         expires 7d;
         etag on;
     }
    
     gzip on;
     gzip_comp_level 3;
     gzip_disable "msie6";
     gzip_vary on;
     gzip_types
         text/javascript
         application/javascript
         application/json
         text/xml
         application/xml
         application/rss+xml
         text/css
         text/plain;
    

    }

  6. Tell kanboard where the database is. Copy the default config first.

    sudo cp /usr/share/nginx/kanboard/config.default.php /usr/share/nginx/kanboard/config.php
    
  7. Edit the config file.

    sudo nano /usr/share/nginx/kanboard/config.php
    
  8. Edit the following lines. Make sure you change the PASSWORD to the password you set above.

    // Database driver: sqlite, mysql or postgres (sqlite by default)
    define('DB_DRIVER', 'mysql');
    
    // Mysql/Postgres username
    define('DB_USERNAME', 'kanboarduser');
    
    // Mysql/Postgres password
    define('DB_PASSWORD', 'PASSWORD'); 
    
    // Mysql/Postgres hostname
    define('DB_HOSTNAME', 'localhost');
    
    // Mysql/Postgres database name
    define('DB_NAME', 'kanboard');
    
  9. Test the nginx config.

    sudo nginx -t
    
  10. If the above comes back successfully, restart nginx service.

    sudo systemctl reload nginx

  11. Browse to the web site you set in the nginx config file above and it should appear, http://kan.example.com:80