Some backstory

When I was thinking about no longer using WordPress and exploring alternatives, static CMSs piqued my interest. I found out about Kirby from a Reddit thread comment, and decided on it.

That said, I went too fast- I was under the impression Kirby was free. And it sort of is- in the sense that there doesn’t seem to be any sort of software feature preventing you from using it- but the license does. This was entirely my fault, I rushed and I didn’t read the fine print. By the time I realized it I had already installed it.

Anywho, I ended up deciding to continue my hunt which led me to Jekyll, which I’m really glad for now.

So what’s this post for? In the process of setting up Kirby I learned some things and I want to document for reference later. Also for anyone who might be installing Kirby themselves.

Infrastructure

My goal was to be as cheap as possible. I ended up using a Vultr VPS. You can read more about my decision here. I chose the cheap Intel “Regular Performance” 10 GB SSD VPS and chose the Debian 12 x64 image for the OS. By choosing New York as the server location and 10 GB SSD, and disabling automatic backups, I could get an instance as cheap as $2.50/mo (but I went $1 more in order to get IPv4)

1. Log into VPS

Log into the VPS- if you’re using Vultr, one you select your VPS from the main dashboard you should see a terminal computer icon in the corner right hand (as of this writing)

2. Update everything

sudo apt-get update
sudo apt-get -y upgrade

3. Install packages you might want

In our case we want at least PHP and related packages to use Kirby:

sudo apt install php php-cli php-mysql libapache2-mod-php php-gd php-xml php-curl php-common php-mbstring -y

Missing additional packages

With the default installation you should already have things like curl, unzip, Apache installed… but if not, you can install those:

sudo apt-get install curl
sudo apt-get install unzip
sudo apt install apache2 apache2-utils -y

With Apache, you’ll also want to

  1. sudo systemctl enable apache2 (Enables the Apache service to start when booting)
  2. sudo systemctl start apache2 (Starts the service)
  3. sudo systemctl status apache2 (Check the status of the Apache service)

4. Install & Setup Kirby

Download

Note that you need -L to follow redirects, or you won’t get anything. -o dumps it into a file.

curl -L -o kirby_main.zip https://download.getkirby.com

Extract

Now unzip. In this case I’m unzipping to the Apache html root folder so that we can serve it.

unzip kirby_main.zip -d /var/www/html/
mv /var/www/html/startkit-main /var/www/html/kirby_blog 

Update Permissions

All files should be 644- but we’ll set everything to 644 first:

chmod -R 644 /var/www/html/kirby_blog/

All folders should be 755. We’ll use find command in conjunction with chmod to do this. The -type d option ensures that chmod is only applied to directories:

sudo find /var/www/html/kirby_blog/ -type d -exec chmod 755 {} +

755: the owner has read, write, and execute permissions (7), while the group and others have read and execute permissions (5).

NOTE: The first time you run the site, you might actually need to have folders set to 777 so that Kirby can set up and write and then you can switch it back to 755.

5. Update firewall

We’ll need to update our firewall so we can actually access the served pages.

sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow ssh
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable
sudo ufw reload

Check results:

sudo ufw status

6. Configure Apache:

Configure Site Config:

Create a config file: sudo nano /etc/apache2/sites-available/your-domain.conf Contents:

<VirtualHost *:80>
ServerAdmin admin@domain_name.com
DocumentRoot /var/www/html/kirby_blog/
ServerName pabloaizpiri.com
ServerAlias www.pabloaizpiri.com

<Directory /var/www/html/kirby_blog/>
  Options FollowSymlinks
  AllowOverride All
  Require all granted
  
  RewriteEngine on
  RewriteBase /
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^panel/(.*) panel/index.php [L]
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Use site config and enable rewrite module:

  1. sudo a2dissite 000-default (disable the default virtual host)
  2. sudo a2ensite your-domain.conf (enable our virtual host)
  3. sudo a2enmod rewrite (enable rewrite module used by Kirby)
  4. sudo systemctl restart apache2.service (restart Apache2)

7. Admin Panel

Update configuration to allow admin panel. Open: sudo nano /var/www/html/kirby_blog/site/config/config.php Add:

return [
  'panel' =>[
    'install' => true
  ]
];

To actually install, you’ll need to go to http://[your domain].com/panel/installation. If you see an error with permissions, you may need to update them per the note at the bottom of step 4.

Done! :tada:

Go to your server’s IP address, and you should be able to access the site! If you see an error with permissions, you may need to update them per the note at the bottom of step 4.

References