Installing BookStack on a Hostinger VPS with HestiaCP on Debian 11, using your domain globalsync.site, involves several steps. HestiaCP simplifies server management, but BookStack's installation still requires some manual configuration, especially for Nginx.
Here's a breakdown of the process:
I. Prerequisites and Initial Setup
-
Hostinger VPS with Debian 11 and HestiaCP:
- Ensure your Hostinger VPS is running Debian 11.
- Confirm HestiaCP is already installed. If not, follow Hostinger's or HestiaCP's official guide to install it. You would typically select a Debian 11 template with HestiaCP when setting up the VPS.
- Access your HestiaCP panel via
https://your-vps-ip:8083with your admin credentials.
-
Domain Name (globalsync.site):
- DNS Configuration: Point your domain
globalsync.siteto your Hostinger VPS's IP address. This is done through your domain registrar's DNS settings (e.g., Hostinger's DNS management). You'll typically set up an 'A' record for@(your root domain) andwwwto your VPS IP. - Add Domain to HestiaCP:
- Log in to your HestiaCP panel.
- Go to the "Web" section.
- Click "Add Web Domain."
- Enter
globalsync.sitein the "Domain" field. - You generally do not need to check "Create DNS zone" if your DNS is managed by Hostinger or another registrar.
- Ensure "Enable SSL for this domain" and "Use Let's Encrypt to obtain SSL certificate" are checked. HestiaCP will automatically handle the SSL certificate.
- Click "Save."
- DNS Configuration: Point your domain
II. BookStack Installation (Manual Method - Recommended for HestiaCP)
HestiaCP manages Nginx and Apache (if used), so directly using a BookStack installation script that sets up its own web server configuration might conflict. The manual installation gives you more control.
-
SSH into your VPS: Use an SSH client (like PuTTY or Terminal) to connect to your VPS as root or a user with sudo privileges.
-
Install BookStack Dependencies: BookStack requires PHP (>=8.2), MariaDB (or MySQL), Git, and Composer. HestiaCP usually installs most of these, but ensure they are the correct versions and necessary PHP extensions are present.
sudo apt update && sudo apt upgrade -y sudo apt install -y git curl unzip mariadb-server php-cli php-fpm php-mysql php-gd php-mbstring php-xml php-zip php-json php-common php-tokenizer php-curlNote: HestiaCP uses PHP-FPM. The
libapache2-mod-phppackage is typically for Apache and might not be needed if Nginx is acting as a proxy to PHP-FPM, which is HestiaCP's default setup. -
Install Composer:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php composer-setup.php sudo mv composer.phar /usr/local/bin/composer php -r "unlink('composer-setup.php');" -
Create a MariaDB Database and User for BookStack:
sudo mysql_secure_installationFollow the prompts to secure your MariaDB installation, set a root password, remove anonymous users, etc.
Then, log in to MariaDB as root and create the database and user:
sudo mysql -u root -pEnter the root password you just set.
CREATE DATABASE bookstack; CREATE USER 'bookstack_user'@'localhost' IDENTIFIED BY 'YOUR_STRONG_PASSWORD'; -- Replace YOUR_STRONG_PASSWORD GRANT ALL ON bookstack.* TO 'bookstack_user'@'localhost'; FLUSH PRIVILEGES; EXIT; -
Download BookStack: Navigate to the web root directory for your domain in HestiaCP. For
globalsync.site, this is typically/home/your_hestiacp_user/web/globalsync.site/public_html.cd /home/your_hestiacp_user/web/globalsync.site/public_html sudo git clone https://github.com/BookStackApp/BookStack.git .The
.at the end clones it into the current directory. Make surepublic_htmlis empty before doing this, or create a subdirectory likebookstackand adjust paths accordingly. -
Configure BookStack:
cp .env.example .env sudo nano .envEdit the
.envfile with the following minimum changes:APP_URL=https://globalsync.site # Your domain DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=bookstack # The database name you created DB_USERNAME=bookstack_user # The database user you created DB_PASSWORD=YOUR_STRONG_PASSWORD # The database password you createdSave and exit Nano (Ctrl+X, Y, Enter).
-
Install BookStack Dependencies (Composer) and Generate Key:
sudo chown -R your_hestiacp_user:www-data /home/your_hestiacp_user/web/globalsync.site/public_html sudo chmod -R 775 /home/your_hestiacp_user/web/globalsync.site/public_html/storage sudo chmod -R 775 /home/your_hestiacp_user/web/globalsync.site/public_html/bootstrap/cache sudo -u www-data composer install --no-dev sudo php artisan key:generate sudo php artisan migrate --seedNote:
your_hestiacp_useris the user you created in HestiaCP forglobalsync.site. If you're running as root, be careful with permissions.
III. HestiaCP Web Domain Configuration (Nginx)
HestiaCP already sets up Nginx for your domain. You just need to ensure it's pointing correctly and can handle BookStack's routing.
-
Adjust Document Root in HestiaCP: By default, HestiaCP points the web domain to
public_html. BookStack's main entry point is withinpublic_html/public. You need to tell HestiaCP to use thepublicsubdirectory as the actual document root.- Log in to HestiaCP.
- Go to the "Web" section.
- Click on your
globalsync.sitedomain. - Check "Custom document root".
- Change the path from
/home/your_hestiacp_user/web/globalsync.site/public_htmlto/home/your_hestiacp_user/web/globalsync.site/public_html/public. - Click "Save."
-
Verify Nginx Configuration (Optional but Recommended): While HestiaCP should handle this, it's good to know where the Nginx configuration files are.
- The primary Nginx config for your domain will be within HestiaCP's managed configuration, typically found around
/home/your_hestiacp_user/conf/web/globalsync.site/nginx.confor similar. - BookStack uses Laravel's routing, which relies on URL rewriting. HestiaCP's default Nginx templates for PHP-FPM generally include the necessary rewrite rules. If you encounter "Not Found" errors, you might need to inspect the Nginx template HestiaCP is using for your domain and ensure it has a block similar to this within the
serverblock:
location / { try_files $uri $uri/ /index.php?$query_string; }If you need to make custom Nginx configurations, HestiaCP allows you to create custom web templates, but this is an advanced topic. For most BookStack installations, the default PHP-FPM template after setting the correct document root should suffice.
- The primary Nginx config for your domain will be within HestiaCP's managed configuration, typically found around
-
Restart Nginx (and potentially PHP-FPM): After making changes, restart the web server services. You can do this from the HestiaCP dashboard (Server -> Services) or via SSH:
sudo systemctl restart nginx sudo systemctl restart php8.x-fpm # Replace 8.x with your PHP version
IV. Accessing BookStack
Open your web browser and navigate to https://globalsync.site.
You should see the BookStack login page.
- Default Login:
- Email:
admin@admin.com - Password:
password
- Email:
V. Post-Installation Steps
- Change Default Credentials Immediately: Log in to BookStack and change the
admin@admin.comuser's email and password. - Configure Application Settings: Explore the BookStack settings to customize it for your needs.
- Backups: Implement a regular backup strategy for your BookStack database and files. HestiaCP has a backup feature, which you should utilize.
- Security: Keep your system and BookStack updated.
By following these steps, you should have a working BookStack instance on your Hostinger VPS with HestiaCP.
