Skip to content
Follow
CMS

How to install Bolt CMS with Nginx on Ubuntu 24.04

Richard
Written by
Richard
Jun 15, 2024 Updated Jul 13, 2026 7 min read
Bolt CMS featured image
Bolt CMS featured image

Installing Bolt CMS with Nginx on Ubuntu 24.04 involves configuring the Nginx web server to correctly deliver your Bolt website files.

Bolt CMS is a flexible content management system built using the Symfony framework. Nginx is a popular web server known for its speed and efficiency, making it a great choice for hosting websites like those built with Bolt.

This setup specifically uses PHP-FPM with Nginx and Bolt on Ubuntu 24.04. This combination helps your website run quickly and respond well to visitors.

⚡ Quick Answer

Install Nginx and MariaDB, then configure PHP-FPM. Create a Bolt database and user in MariaDB. Finally, deploy the Bolt CMS application files to your server.

Install Nginx HTTP server on Ubuntu

Install Nginx on Ubuntu to serve your Bolt CMS website. This web server handles incoming traffic for your site. Running a few simple commands in the terminal will update your system and install Nginx, getting your server ready to handle web traffic.

To do that, open the Ubuntu terminal and run the commands below to install the Nginx web server.

🐧Bash / Shell
sudo apt update
sudo apt install nginx

Once Nginx is installed, the commands below can start, stop, and enable the Nginx web server to start automatically when your server boots up.

🐧Bash / Shell
sudo systemctl stop nginx
sudo systemctl start nginx
sudo systemctl enable nginx

You can test the Nginx web server by opening your web browser and browsing to the server’s localhost or IP address.

http://localhost

Nginx default welcome page on Ubuntu 24.04
Nginx default welcome page on Ubuntu 24.04

When you see the “Welcome to nginx!” page, it means the Nginx HTTP server is successfully installed.

Additional help on installing Nginx on Ubuntu is in the link below.

How to install Nginx on Ubuntu

Install the MariaDB database server on Ubuntu

Bolt CMS needs a database to store its information, and MariaDB is a good choice. To install the MariaDB database server on Ubuntu, you’ll open the terminal and run commands to update your system and install the necessary package. This prepares your server to hold Bolt’s data.

To install and use the MariaDB database server, use the instructions below.

Open the Ubuntu terminal and run the commands below to install the MariaDB database server.

🐧Bash / Shell
sudo apt update
sudo apt install mariadb-server

Once the MariaDB database server is installed, use the commands below to stop, start, and enable the MariaDB server to start automatically when the server boots.

🐧Bash / Shell
sudo systemctl stop mariadb
sudo systemctl start mariadb
sudo systemctl enable mariadb

Run the following commands to validate and test if the MariaDB database server is installed successfully.

🐧Bash / Shell
sudo mariadb

Once you run the commands above, it will log you onto the MariaDB console and display a message similar to the one below.

💻Code
Welcome to the MariaDB monitor.  Commands end with ; or g.
Your MariaDB connection id is 32
Server version: 10.11.2-MariaDB-1 Ubuntu 23.04

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

MariaDB [(none)]> 

The message tells you that the server is installed successfully.

Additional help on installing MariaDB.

Create a Bolt database

After installing MariaDB, you must create a dedicated database for Bolt CMS. This involves setting up a database named ‘boltdb’ and creating a user account called ‘boltdbuser’ who will have full control over it. This ensures Bolt has a secure place to store its content.

As part of the setup, we will create a boltdb database and a user account called boltdbuser.

Finally, we’ll grant the boltdbuser full access to the boltdb database.

All the database steps above can be done using the commands below:

But first, log on to the MariaDB database server:

🐧Bash / Shell
sudo mariadb

Then run the commands below to complete the steps:

💻Code
CREATE DATABASE boltdb CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER boltdbuser@localhost IDENTIFIED BY 'type_your_password_here';
GRANT ALL ON boltdb.* TO boltdbuser@localhost WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit

Ensure to replace ‘type_your_password_here ‘with your password.

Install PHP-FPM on Ubuntu Linux

Bolt CMS needs PHP-FPM to work, and it requires a specific older version. To install the correct PHP 7.2 version on Ubuntu, you first need to add a special software source (repository) and then install the PHP-FPM package and other needed extensions. This ensures Bolt runs correctly.

To install an older version of PHP-FPM, add this repository.

🐧Bash / Shell
sudo add-apt-repository ppa:ondrej/php

Then, run the commands below to install the PHP 7.2 version.

🐧Bash / Shell
sudo apt install php7.2-fpm php7.2-intl php7.2-mysql php7.2-curl php7.2-cli php7.2-zip php7.2-xml php7.2-gd php7.2-common php7.2-mbstring php7.2-xmlrpc php7.2-json php7.2-sqlite3 php7.2-soap php7.2-zip

Additional help on installing PHP

How to install PHP on Ubuntu Linux

Download Bolt files

Download the Bolt CMS files to your server to begin setup. First, install Composer, Curl, and Git, which are tools needed to manage packages and download files. Then, you’ll move to the correct web directory to download Bolt and set up its basic configuration.

First, install Composer, Curl, and other dependencies.

🐧Bash / Shell
sudo apt install curl git
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

Then, navigate to the /var/www/ directory and clone the Bolt files. Next, make a copy of Bolt’s sample config.yml.dist file to create a new one called config.yml.

Command Prompt
cd /var/www
sudo git clone https://github.com/bolt/bolt.git
sudo cp /var/www/bolt/app/config/config.yml.dist /var/www/bolt/app/config/config.yml

Next, open the Bolt config.yml file using the command below.

🐧Bash / Shell
sudo nano /var/www/bolt/app/config/config.yml
⚠️Warning
Then, add the database name, username, and password created above. Save the file and exit.
💻Code

# If you're trying out Bolt, just keep it set to SQLite for now.
database:
driver: mysql
databasename: boltdb
username: boltdbuser
password: your_strong_password
⚠️Warning
After setting up your environment above, change to the bolt directory and install all required PHP dependencies for Bolt CMS using Composer.
Command Prompt
cd /var/www/bolt
sudo composer install
sudo chown -R www-data:www-data /var/www/bolt

Once you have completed all the above steps, continue configuring the Nginx web server below to serve the Bolt content.

Run the commands below to create a Nginx server host file for Bolt.

🐧Bash / Shell
sudo nano /etc/nginx/sites-available/bolt.conf

Then, copy and paste the content block below into the Nginx server block.

🐘PHP
server {
listen 80;
listen [::]:80;
server_name bolt.example.com;
root /var/www/bolt;
index index.php;

location / {
try_files $uri $uri/ /index.php?$query_string;
}

# Generated thumbnail images
location ~* /thumbs/(.*)$ {
try_files $uri $uri/ /index.php?$query_string;
}

# Block PHP files from being run in upload (files), app, theme and extension directories
location ~* /(?:app|extensions|files|theme)/(.*).php$ {
deny all;
}


# Block access to Markdown, Twig & YAML files directly
location ~* /(.*).(?:dist|markdown|md|twig|yaml|yml)$ {
deny all;
}


location ~ .php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
include fastcgi_params;
fastcgi_intercept_errors on;
}
}

Save the file.

You enable the Bolt CMS virtual host by running the `sudo a2ensite bolt.conf` command, which creates a symbolic link in Nginx's sites-enabled directory. After enabling the virtual host, you restart the Nginx server with `sudo systemctl restart nginx` to apply the new configuration and make Bolt CMS accessible.

🐧Bash / Shell
sudo ln -s /etc/nginx/sites-available/bolt.conf /etc/nginx/sites-enabled/
sudo systemctl restart nginx.service

Setup Let’s Encrypt SSL/TLS for Bolt

Secure your Bolt website with a free Let’s Encrypt SSL/TLS certificate using Nginx. This process uses a tool called Certbot to get and install the certificate. Then, you’ll restart Nginx to make the security changes active, protecting your site’s data.

Please read the post below for additional resources on installing and creating Let’s Encrypt SSL certificates for Nginx.

How to set up Let’s Encrypt SSL certificate for Nginx on Ubuntu Linux

Once you have restarted the Nginx web server, open your browser and browse to the server hostname or IP address defined in the Nginx server block.

💻Code
http://bolt.example.com/

A Bolt setup wizard page should appear. Create the first user for the site.

Bolt CMS create first user
Bolt CMS create first user

Your Bolt site should be set up and ready to use.

Bolt CMS setup complete
Bolt CMS setup complete

That should do it!

Conclusion

  • Installing Bolt CMS with Nginx on Ubuntu brings robustness and performance to your web application, with Nginx serving as a high-performance web server and Bolt CMS offering user-friendly interface and content management features.
  • The process involves installing Nginx and MariaDB, creating a Bolt database, installing PHP-FPM, downloading Bolt files, configuring Nginx, and securing the site with Let’s Encrypt SSL/TLS.
  • Following the step-by-step guide outlined in this article, you can successfully set up and host your web content using the powerful combination of Bolt CMS and Nginx on Ubuntu 24.04.

Was this guide helpful?

Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

📚 Related Tutorials

How to Install GNOME Desktop on Ubuntu 24.04
Ubuntu Linux How to Install GNOME Desktop on Ubuntu 24.04
How to Install KDE Desktop on Ubuntu 24.04
Ubuntu Linux How to Install KDE Desktop on Ubuntu 24.04
How to install Bolt CMS with Apache on Ubuntu 24.04
CMS How to install Bolt CMS with Apache on Ubuntu 24.04

No comments yet — be the first to share your thoughts!

Leave a Comment

Your email address will not be published. Required fields are marked *