Installing Baikal on Debian 9 with Nginx and MySQL

The following are the steps I used to install Baikal CalDAV / CardDAV server on Debian 9 stretch using Nginx and MySQL.  This setup was for a lab environment.

Install Prerequisites

apt-get install nginx mysql-server php-fpm php-mysql php-sabre-dav git


service php7.0-fpm start

Set PHP-FPM to always start on boot

systemctl enable php7.0-fpm

Configure Nginx

Backup the default config file

​​cp /etc/nginx/sites-available/default /etc/nginx/sites-available/default.backup

Create a new config file

nano /etc/nginx/sites-available/default

Replace all text with the following

server {
  listen 80;
  server_name _;

  root /var/www/html/baikal/html;
  index index.php;

  rewrite ^/.well-known/caldav /dav.php redirect;
  rewrite ^/.well-known/carddav /dav.php redirect;

  charset utf-8;

  location ~ /(\.ht|Core|Specific) {
    deny all;
    return 404;

  location ~ ^(.+\.php)(.*)$ {
    try_files $fastcgi_script_name =404;
    include /etc/nginx/fastcgi_params;
    fastcgi_split_path_info ^(.+\.php)(.*)$;
    fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO $fastcgi_path_info;


Start nginx

service nginx start

Set nginx to always start on boot

systemctl enable nginx

Creating the MySQL database

Log into MySQL

myqsl -u root -p

Create the Baikal database

create database baikal;

Create a user for the database

create user 'baikaluser'@'localhost' identified by 'baikalPass';

Grant permissions to the database for the created user

grant all on baikal.* to 'baikaluser'@'localhost';

Install Baikal

Clone the repository to the document root

git clone /var/www/html

Set permissions for the web user

chown -R www-data:www-data /var/www/html/baikal

Start nginx

service nginx start

Configure Baikal

You can being configuring Baikal at http://YOURSERVER/admin/install/

2017-12-20 19_48_58-Baïkal Maintainance.png

2017-12-20 19_50_16-Baïkal Maintainance.png

2017-12-20 19_52_50-Baïkal Maintainance.png

2017-12-20 19_53_09-Baïkal 0.4.6 Web Admin.png

2017-12-20 19_54_41-Baïkal 0.4.6 Web Admin.png

This entry was posted in linux. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s