Installing nginx if it’s not installed
-
First, update the repo to get latest versions
sudo apt update
-
Install nginx
sudo apt install nginx (you can ignore this step if you ran it above for the above install)
-
Enable the service to start on boot
sudo systemctl enable nginx
Install PHP
-
Update the repo to get latest versions
sudo apt update
-
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
-
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
-
Install
Maridadb-server
andmariadb-client
sudo apt install mariadb-server mariadb-client
-
Secure the installation
sudo mysql_secure_installation
-
First will prompt you for current password, this will be blank so just press enter
Enter current password for root (enter for none):
-
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
-
The rest, accept the defaults, and complete the configuration.
-
Enable the service to start on boot.
sudo systemctl enable mariadb-server
Setting up database for Kanboard
-
Login to mysql, this was prompt you for your password you set earlier.
sudo mysql -u root -p
-
Create database
CREATE DATABASE kanboard CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-
Create a user (Please change the password at the end to a secure password)
create user 'kanboarduser'@'localhost' identified by 'your-password';
-
Grant privileges to the above account
grant all privileges ON kanboard.* TO 'kanboarduser'@'localhost';
-
Flush privileges and exit
flush privileges; exit;
Installing Kanboard
-
Download the latest release
git clone https://github.com/kanboard/kanboard.git
-
Move to the nginx directory
sudo mv kanboard /usr/share/nginx/kanboard
-
Amend permissions of the folder
sudo chown www-data:www-data /usr/share/nginx/kanboard/data -R
-
Create the nginx config file
sudo nano /etc/nginx/conf.d/kanboard.conf
-
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 thelisten 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;
}
-
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
-
Edit the config file.
sudo nano /usr/share/nginx/kanboard/config.php
-
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');
-
Test the nginx config.
sudo nginx -t
-
If the above comes back successfully, restart nginx service.
sudo systemctl reload nginx
-
Browse to the web site you set in the nginx config file above and it should appear, http://kan.example.com:80