On this page
- What does BookStack need on the server?
- How do you install the packages?
- How do you create the database?
- How do you fetch BookStack and run the installer steps?
- How do you serve it with Nginx and HTTPS?
- How do you sign in for the first time?
- How do you set up outgoing mail?
- How do you update BookStack safely?
- What if a page shows an error?
- Questions
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 mariadbComposer 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 --versionHow 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 .envSet 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-PassThen 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 .envKeep 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.netRaise 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:clearRead 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 thatwww-datacannot write. - Broken styles or links to http:
APP_URLdoes not match the HTTPS address. Fix it and runphp artisan config:clear. - Uploads fail: compare
client_max_body_sizein Nginx with the PHP upload limits. - 502 Bad Gateway: the FPM socket path in the server block does not match
ls /run/php/, orphp8.3-fpmis 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.
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.
More in Self-hosted apps
- Nextcloud on Nginx
- ownCloud Infinite Scale
- Seafile file sync
- Vaultwarden password vault
- Passbolt team password manager
- Gitea Git hosting
- Forgejo Git server
- GitLab Community Edition
- Gogs Git service
- Wiki.js
- Outline knowledge base
- Paperless-ngx documents
- n8n workflow automation
- Activepieces automation
- Plausible Analytics (Community Edition)
- Umami analytics
- Mattermost team chat
- Matrix Synapse with Element
- Jitsi Meet video calls
- ONLYOFFICE Docs with Nextcloud
- HashiCorp Vault secrets server
- OpenBao secrets management
- Infisical secrets manager
- Authelia SSO and forward auth
- Zitadel identity platform
- VS Code in the browser (code-server)
- Joplin Server for notes sync
- Firefly III personal finance
- Snipe-IT asset tracking
- Odoo ERP on Ubuntu or Debian
- ERPNext with frappe_docker
- Dolibarr ERP and CRM with Nginx
- Penpot design tool with Docker
- Planka kanban boards
- Leantime project management
- Wekan boards with Docker
- Cal.com scheduling
- Chatwoot support inbox
- Mautic marketing automation
- DocuSeal document signing
- Metabase dashboards
- Appwrite backend server
- Self-hosted Supabase
- PocketBase backend
- RustDesk relay server
- Traccar GPS tracking
- Redmine project tracker
- The Lounge IRC client
- CyberChef data toolbox
- Typebot chat forms
- AFFiNE workspace
- Overleaf Community Edition
- Neko shared virtual browser
- imgproxy image resizing
- NetBox network inventory
- UVdesk help desk
- YetiForce CRM