BookStack is an open-source platform designed to help you organize and manage documentation. It's an easy-to-use tool that can be installed on an Ubuntu server and served with Nginx. In this guide, we’ll show you how to install BookStack with Nginx on Ubuntu 20.04 and mirror your site using rsync to ensure redundancy. If you're looking for hosting solutions, a Windows VPS UK might be ideal for hosting your BookStack instance.
Step 1: Update Your System
Before installing any software, it's important to update your Ubuntu system. Run the following commands to ensure your server is up-to-date:
sudo apt update && sudo apt upgrade
Keeping your system updated is critical whether you're using a local server or a UK Windows VPS to host your application.
Step 2: Install Required Dependencies
BookStack requires several dependencies such as PHP, MySQL, and Nginx. Install them by running the following command:
sudo apt install nginx mysql-server php php-fpm php-mysql git unzip
Once installed, start and enable the services:
sudo systemctl start nginx
sudo systemctl enable nginx
sudo systemctl start mysql
sudo systemctl enable mysql
These dependencies are required to run BookStack, whether you're deploying on an Ubuntu server or on a Windows Virtual Private Server hosting platform.
Step 3: Configure MySQL for BookStack
BookStack uses MySQL as its database, so you'll need to create a database and user. First, secure your MySQL installation:
sudo mysql_secure_installation
Log into MySQL and create the BookStack database:
CREATE DATABASE bookstack;
CREATE USER 'bookstackuser'@'localhost' IDENTIFIED BY 'your-password';
GRANT ALL PRIVILEGES ON bookstack.* TO 'bookstackuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
This setup ensures that BookStack has a dedicated user for database operations, which can be mirrored across multiple VPS Windows Servers or other environments using rsync.
Step 4: Download and Install BookStack
Now, clone the BookStack repository from GitHub and install it on your server:
cd /var/www
sudo git clone https://github.com/BookStackApp/BookStack.git --branch release --single-branch bookstack
Set the correct ownership and permissions for the BookStack directory:
sudo chown -R www-data:www-data /var/www/bookstack
Now install Composer to handle PHP dependencies:
cd /var/www/bookstack
sudo apt install composer
composer install
Step 5: Configure BookStack
After the installation, copy the example environment configuration file:
cp .env.example .env
Open the .env
file and update it with your MySQL database details:
DB_DATABASE=bookstack
DB_USERNAME=bookstackuser
DB_PASSWORD=your-password
Once done, generate the application key:
php artisan key:generate
Step 6: Configure Nginx
Create a new Nginx server block configuration file for BookStack:
sudo nano /etc/nginx/sites-available/bookstack
Add the following configuration:
server {
listen 80;
server_name your-server-ip;
root /var/www/bookstack/public;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
Enable the site and restart Nginx:
sudo ln -s /etc/nginx/sites-available/bookstack /etc/nginx/sites-enabled/
sudo systemctl restart nginx
Your BookStack instance is now accessible via the server IP. This setup works well on Windows VPS hosting UK and other similar environments.
Step 7: Mirror Your BookStack Installation with rsync
To ensure that your BookStack installation is mirrored across multiple servers, use rsync. This is especially useful when you’re running multiple VPS Windows Servers or need redundancy for your data.
Use the following command to sync your BookStack files to a remote server:
rsync -avz /var/www/bookstack/ user@remote-server:/var/www/bookstack/
This command mirrors your BookStack installation on a remote server. You can automate this process using cron jobs for regular backups.
Step 8: Finalize and Access BookStack
At this point, your BookStack instance should be fully installed and accessible. Navigate to http://your-server-ip
in your browser to complete the initial setup.
Whether you’re hosting on a local server or a UK Windows VPS, following these steps will give you a functional and well-configured BookStack platform.