Introduction

BookStack is a free and open-source platform for creating documentation and wikis. It is user-friendly and allows you to organize your knowledge base efficiently. This guide will walk you through the installation of BookStack with Nginx on Ubuntu 20.04, which can be effectively hosted on a Windows VPS UK for optimal performance.

Prerequisites

  • An Ubuntu 20.04 server with root access
  • Basic knowledge of Linux commands
  • A registered domain name (optional)

Step 1: Update Your System

Start by updating your package index and upgrading any existing packages:

sudo apt update && sudo apt upgrade -y

Step 2: Install Required Packages

Install necessary packages including Nginx, PHP, and the required PHP extensions:

sudo apt install nginx php-fpm php-mysql php-xml php-mbstring php-zip php-curl -y

Step 3: Install MariaDB

Install MariaDB server:

sudo apt install mariadb-server -y

Secure your MariaDB installation:

sudo mysql_secure_installation

Log into MariaDB to create a database for BookStack:

sudo mysql -u root -p
CREATE DATABASE bookstack;
CREATE USER 'bookstackuser'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON bookstack.* TO 'bookstackuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Step 4: Install BookStack

Change to the web directory and clone the BookStack repository:

cd /var/www/
sudo git clone https://github.com/BookStackApp/BookStack.git

Change the ownership of the directory:

sudo chown -R www-data:www-data /var/www/BookStack

Navigate to the BookStack directory and install Composer:

cd BookStack
sudo curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer

Install the required dependencies:

composer install

Step 5: Configure Environment Variables

Copy the example environment file and edit it:

cp .env.example .env
nano .env

Update the database settings in the .env file:

DB_DATABASE=bookstack
DB_USERNAME=bookstackuser
DB_PASSWORD=your_password

Step 6: Run Migrations

Run the migrations to set up the database:

php artisan migrate

Step 7: Configure Nginx for BookStack

Create a new Nginx configuration file:

sudo nano /etc/nginx/sites-available/bookstack

Add the following configuration, replacing your_domain.com with your actual domain:

server {
    listen 80;
    server_name your_domain.com;

    root /var/www/BookStack/public;
    index index.php index.html index.htm;

    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; # Adjust PHP version if necessary
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

Enable the new site configuration:

sudo ln -s /etc/nginx/sites-available/bookstack /etc/nginx/sites-enabled/

Test the Nginx configuration:

sudo nginx -t

Restart Nginx:

sudo systemctl restart nginx

Step 8: Conclusion

You have successfully installed BookStack on Ubuntu 20.04, providing a powerful platform for managing your documentation. This setup can greatly benefit from being hosted on a Windows VPS. For additional options, explore various VPS UK Windows solutions, including Windows Virtual Private Server Hosting and Windows VPS Hosting UK for optimal performance.

© 2024 BookStack Installation Tutorial. All rights reserved.

Was this answer helpful? 0 Users Found This Useful (0 Votes)