Log inSign up

BookStack: a self-hosted documentation shelf on your VPS

Clone the BookStack release branch into /var/www/bookstack, run composer install --no-dev, fill in .env with your MariaDB credentials and APP_URL, then run php artisan key:generate and php artisan migrate. Nginx with PHP-FPM serves the public folder and Certbot adds HTTPS. Sign in with the default admin account and change it at once.

Topic: Self-hosted apps · Tested on: Ubuntu 24.04 and 22.04, Debian 12 and 13 · Updated 2026-12-03

What does BookStack need on the server?

BookStack is a Laravel application, so the stack is PHP, a MySQL-compatible database and a web server. A 2 GB plan is comfortable for a team wiki with image uploads; 1 GB works for a personal notebook if you add a little swap.

  • OS: Ubuntu 24.04 (PHP 8.3) or Debian 12 (PHP 8.2) and Debian 13 (PHP 8.4). Current BookStack releases need PHP 8.2 or newer, so Ubuntu 22.04 with PHP 8.1 is not a good base without a third-party PHP repository.
  • Database: MariaDB from the distribution archive is fine.
  • DNS: an A and AAAA record for a name such as docs.example.net, created as shown in DNS records.

Log in as your sudo user (see first SSH session) and update the package lists with sudo apt update. The project also publishes an all-in-one install script for Ubuntu; the manual route below shows every moving part so you can maintain it later.

How do you install the packages?

Everything comes from the standard archive; the unversioned PHP names resolve to the right version on each release.

sudo apt install -y nginx mariadb-server git unzip curl \
  php-fpm php-cli php-curl php-mbstring php-ldap php-xml \
  php-zip php-gd php-mysql php-tokenizer
php -v
ls /run/php/
sudo systemctl enable --now nginx mariadb

Composer is the PHP dependency tool. Install it from the official installer, which verifies its own signature:

cd /tmp
curl -sS https://getcomposer.org/installer -o composer-setup.php
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
composer --version

How do you create the database?

Create one database and one user that only has rights on it. Open the MariaDB shell with sudo mariadb and run:

CREATE DATABASE bookstack CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'bookstack'@'localhost' IDENTIFIED BY 'Use-A-Long-Random-Pass';
GRANT ALL PRIVILEGES ON bookstack.* TO 'bookstack'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Generate a real password with openssl rand -base64 24 instead of the sample. If MariaDB is new to you, the MariaDB guide covers the secure install step.

How do you fetch BookStack and run the installer steps?

Clone only the release branch, install the PHP libraries, then set the environment file.

sudo git clone https://github.com/BookStackApp/BookStack.git \
  --branch release --single-branch /var/www/bookstack
sudo chown -R deploy:www-data /var/www/bookstack
cd /var/www/bookstack
composer install --no-dev --no-plugins
cp .env.example .env
nano .env

Set these keys in .env:

APP_URL=https://docs.example.net
DB_HOST=localhost
DB_DATABASE=bookstack
DB_USERNAME=bookstack
DB_PASSWORD=Use-A-Long-Random-Pass

Then generate the application key, build the tables and give the web server write access to the folders that change at run time:

php artisan key:generate --force
php artisan migrate --force
sudo chown -R www-data:www-data storage bootstrap/cache public/uploads
sudo chmod -R 775 storage bootstrap/cache public/uploads
sudo chmod 640 .env

Keep APP_URL exactly equal to the address people type; BookStack builds every link from it.

How do you serve it with Nginx and HTTPS?

Point Nginx at the public folder and hand PHP files to the FPM socket you saw earlier (here PHP 8.3 on Ubuntu 24.04).

server {
    listen 80;
    listen [::]:80;
    server_name docs.example.net;
    root /var/www/bookstack/public;
    index index.php;
    client_max_body_size 50m;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php8.3-fpm.sock;
    }
}

Save it as /etc/nginx/sites-available/bookstack, then enable it and request a certificate:

sudo ln -s /etc/nginx/sites-available/bookstack /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
sudo ufw allow 'Nginx Full'
sudo apt install -y certbot python3-certbot-nginx
sudo certbot --nginx -d docs.example.net

Raise upload_max_filesize and post_max_size in /etc/php/8.3/fpm/php.ini to match the 50 MB body size if people attach large files, then restart php8.3-fpm. More on certificates is in the Certbot guide.

How do you sign in for the first time?

Open https://docs.example.net and log in with admin@admin.com and the password password. Those are public defaults, so go straight to your profile, change the email and password, and enable multi-factor authentication under My Account. After that, create roles under Settings, Roles: for example an Editor role that can create pages in specific shelves and a Viewer role for the rest of the team.

BookStack organises content as shelves, books, chapters and pages. Permissions can be set on each level, which makes it easy to keep an internal runbook book private while a public handbook stays readable.

How do you set up outgoing mail?

BookStack sends invitations, password resets and notifications by SMTP. Do not plan on port 25 being open from the server; if you need direct delivery, ask support with a ticket first. The reliable route is an authenticated relay on port 587, described in send app mail through an SMTP relay. Add the relay details to .env:

MAIL_DRIVER=smtp
MAIL_HOST=smtp.relay.example.net
MAIL_PORT=587
MAIL_ENCRYPTION=tls
MAIL_USERNAME=bookstack@example.net
MAIL_PASSWORD=relay-password
MAIL_FROM=bookstack@example.net
MAIL_FROM_NAME="Docs"

Clear the config cache with php artisan config:clear and use the Send Test Email button under Settings, Maintenance to confirm it works.

How do you update BookStack safely?

Updates are a pull of the release branch followed by Composer and migrations. Back up first: dump the database with mysqldump and copy .env, public/uploads and storage/uploads.

cd /var/www/bookstack
sudo mysqldump bookstack > ~/bookstack-$(date +%F).sql
git pull origin release
composer install --no-dev --no-plugins
php artisan migrate --force
php artisan cache:clear
php artisan config:clear
php artisan view:clear

Read the release notes before a jump across several versions, since some releases raise the minimum PHP version. Ordinary package updates for Nginx, PHP and MariaDB come through sudo apt upgrade. For a full server copy on top of that, the daily backup add-on keeps snapshots of the whole disk.

What if a page shows an error?

  • 500 error after install: run tail -n 50 storage/logs/laravel.log. Most often the cause is a folder that www-data cannot write.
  • Broken styles or links to http: APP_URL does not match the HTTPS address. Fix it and run php artisan config:clear.
  • Uploads fail: compare client_max_body_size in Nginx with the PHP upload limits.
  • 502 Bad Gateway: the FPM socket path in the server block does not match ls /run/php/, or php8.3-fpm is stopped.

For more apps of this kind on the same server, see self-hosting on a VPS.

Plans that fit this guide

Base city prices. Every plan includes a dedicated IPv4 address, IPv6, full root and all 18 images.

All prices
PlanFits becauseSizeMonthlyOrder from
A1-2personal or small team wiki1 vCPU, 2 GB RAM, 50 GB NVMe$7.20/mo$43.20 for 6 months
A2-4busy team wiki with many uploads2 vCPU, 4 GB RAM, 100 GB NVMe$14.40/mo$43.20 for 3 months

Questions about BookStack documentation

Can BookStack run in Docker instead?

Yes. Community-maintained container images exist and work well with Docker Compose. The manual install here is the method the project documents first and is easy to update.

What is the default BookStack login?

The email admin@admin.com with the password password. Change both immediately after the first sign-in.

Does BookStack support single sign-on?

Yes. It supports LDAP, SAML 2.0 and OpenID Connect through settings in .env, which lets you connect it to an identity provider you already run.

How much disk does BookStack use?

The application itself is small. Disk use grows with uploaded images and attachments, which live under public/uploads and storage/uploads.

Is Ubuntu 22.04 supported?

Its stock PHP 8.1 is older than current BookStack releases require. Use Ubuntu 24.04 or Debian 12/13 for a clean install from the standard archive.