Skip to main content

Installation

System Requirements

Blesta is compatible with most web server environments that support PHP and MySQL or MariaDB, and while Blesta is frequently installed on a shared server, for performance and security we recommend installing on a fresh Virtual Machine using our bash installer.

info

Certain extensions, particularly 3rd party extensions and themes, may have their own unique requirements.

RequiredRecommended
PHP VersionPHP 7.2, 7.3, 7.4, 8.1, 8.2, or 8.3PHP 8.2
PHP Configmemory_limit="512M" or greater
max_input_vars="10000"
disable_functions="" none defined
open_basedir="" none defined
PHP ExtensionsIoncube Loaders, PDO, pdo_mysql, curl (v7.10.5+), openssl (v 1.1.1a+), gmp, imap, json, ldap, libxml, mailparse, iconv, mbstring, simplexml, soap, gd, and zlib
MySQL / MariaDBMySQL 5.7.7+ or MariaDB 10.2.2+
max_allowed_packet = 128M or higher, and wait_timeout = 3600 or higher
MariaDB 10.5.27

Installing Blesta

Bash Script for Fresh Min AlmaLinux 9

There are several ways to install Blesta, but the best way is to install Blesta on a fresh minimal Almalinux 8, 9 or 10 VM using our beta bash script. You should install or configure your own firewall after installation. We recommend 20GB disk, 4GB RAM, and 2 CPU cores as a suggestion to start.

Install using the BASH installer

Only run this as root on a fresh minimal AlmaLinux 8, 9, or 10 VM with nothing else on it. Fresh server only. The script will install all the dependencies (Apache, MariaDB, PHP, Certbot SSL cert) and Blesta. There are some questions you'll need to answer during installation. Your hostname should resolve to your VM's IP before running the installer. The installer does not configure any firewall at this time.

dnf install curl -y
curl -o install-blesta.sh https://raw.githubusercontent.com/blesta/install-blesta/main/install-blesta.sh
chmod +x install-blesta.sh
./install-blesta.sh
You're done

If you installed with the bash installer, you're done, congratulations!

Install using an Auto-Installer

Blesta is available to install on shared hosting servers through Softaculous and Installatron

Install Manually

This video may help, specific steps outlined below the video.

1. Download Blesta

Download Blesta from blesta.com or visit the download area. The latest version of Blesta is also available at blesta.com/latest.zip.

Via SSH
wget https://www.blesta.com/latest.zip

2. Unzip the Archive

Unzip the Blesta archive (.zip file) using your favorite compression utility. On Windows, right click and select "Extract All". If the zip is uploaded to or downloaded directly to a Linux server, run the following in your terminal (replace latest.zip with the filename if you downloaded a specific version like blesta-x.x.x.zip):

Via SSH
unzip latest.zip

3. Upload Files & Launch Installer

Upload the contents of the /blesta/ directory to your server where you will be accessing Blesta. Before you continue any further, ensure you've created a database that Blesta can be installed into. You'll need your database host (usually localhost), database name, database user, and database user password to continue with installation.

If you unzip the distribution on your server, move the contents of the "blesta" directory to your docroot. Move the "uploads" directory a level above your docroot.

Blesta may be installed in one of two ways, either via the web through your browser, of via command line (CLI over SSH).

Web Installation

Follow these steps to install Blesta via the web.

  1. Point your web browser to the location where you uploaded the contents of blesta (e.g. https://yourdomain.com/path_to_blesta/).
  2. Follow the on screen instructions to complete installation.
  3. Once installation completes, you'll be prompted to create your administrator user and enter your license key or start a free trial.

For advanced users and developers who may need to script multiple installations, a web-installer CURL script can be used to automate installations.

Show example Web Installer Curl Script
Example Web Installer CURL Script
<?php
#
# This makes a POST request to the Blesta installer
#

$post = [
'agree' => 'yes',
'host' => 'localhost',
'port' => '3306',
'database' => 'blesta',
'user' => 'user',
'password' => 'password',
];

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'myblestadomain.com/install/process');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$errors = curl_error($ch);
curl_close($ch);

echo "RESPONSE: ";
print_r($response);

echo "ERRORS: ";
var_dump($errors);
warning

If your web server is not Apache, or is missing mod_rewrite, the CURL URL must be pre-pended with index.php, e.g. myblestadomain.com/index.php/install/process

Command Line (CLI) Installation

  1. In an SSH shell/terminal, cd to the directory you uploaded Blesta to.
  2. The CLI installer can be run in interactive mode, or non-interactive mode by bypassing parameters.
Interactive Mode

For interactive mode, run the following command. It may be necessary to include the full path to PHP.

Via SSH
php ./index.php install

You will be prompted for details during installation.

Non-Interactive Mode

For installation that does not include admin account creation or license activation, run (update values):

Via SSH
php ./index.php install -dbhost DATABASE_HOST -dbport DATABASE_PORT -dbname DATABASE_NAME -dbuser DATABASE_USER -dbpass DATABASE_PASS -hostname WEBSITE_HOSTNAME -docroot DOCUMENT_ROOT_PATH

For installation that includes admin account creation and license activation, run (update values):

Via SSH
php ./index.php install -dbhost DATABASE_HOST -dbport DATABASE_PORT -dbname DATABASE_NAME -dbuser DATABASE_USER -dbpass DATABASE_PASS -hostname WEBSITE_HOSTNAME -docroot DOCUMENT_ROOT_PATH -domain DOMAIN -licensekey LICENSE_KEY -firstname FIRST_NAME -lastname LAST_NAME -email EMAIL -username USERNAME -password PASSWORD

Below is a list of accepted parameters.

ParameterDescriptionVersion Added
-dbhostThe database hostname (usually localhost)3.0
-dbportThe database port (usually 3306)3.0
-dbnameThe database name3.0
-dbuserThe database user3.0
-dbpassThe database password3.0
-hostnameThe website hostname. For example, billing.domain.com. The is the hostname where Blesta will be accessed from. If not set, will attempt to detect the hostname from server configuration, which in many cases will not be accurate.3.0
-docrootThe full absolute path to the web server's document root (e.g. /var/www/html/). This should not be set to Blesta's installed directory unless Blesta is installed in document root. If this value is not set, it will be set based on your current working directory, which will not be accurate unless the current working directory is the document root. This value can be changed from within Blesta, after installation, under Settings > System > General > "Root Web Directory".4.6
-domain(Optional) The domain to be used in template email addresses. This value is used to determine email addresses for templates and can be changed under Settings > Company > Emails.5.10
-licensekey(Optional) The license key for Blesta. If none is provided, a trial license will befetched.5.10
-firstnameThe First Name of the first Staff user.5.10
-lastnameThe Last Name of the first Staff user.5.10
-emailThe email address for the first Staff user.5.10
-usernameThe username for the first Staff user.5.10
-passwordThe password for the first Staff user.5.10
  1. Once installation completes, direct your web browser to https://yourdomain.com/path_to_blesta/admin to create your administrator user and enter your license key or start a free trial if you did not install with non-interactive mode, otherwise login with the credentials provided.
Free Trial

If you do not have a license key, and have not already had a free trial you will be able to activate a free trial during the installation process directly. Please note that free trials cannot be activated for "localhost". If you need to purchase a license, you can do so at blesta.com.

  1. Set up a Cron Job

Once installation is complete, a cron job must be created to automate tasks within Blesta. Go to [Settings] > [System] > Automation, and copy the "Cron Command", for use in creating a cron job on your server. Most hosting control panels provide an easy way to create cron jobs, follow the documentation for your control panel to complete this important step. The cron job should run every minute. Once the cron has been configured, verify that the status icon turns green and displays the last time run on the System Automation page within Blesta.

Running the cron via the web

Using CLI is always recommended, but the cron may be run by accessing https://www.yourdomain.com/blesta/install/path/cron/?cron_key=CRONKEY where CRONKEY is your cron key as displayed under "Update Cron Key". This key is not set by default

wget method

/usr/bin/wget -O /dev/null -q https://www.yourdomain.com/blesta/cron/?cron_key=CRONKEY

If you do not have mod_rewrite, the URL will need to include index.php, for example: https://www.yourdomain.com/blesta/install/path/index.php/cron/?cron_key=CRONKEY where CRONKEY is your cron key as displayed under "Updated Cron Key".

Advanced Options

System Configuration

There are a number of configuration settings that may be set before or after installation.

Requiring index.php in URLs

By default Blesta does not include index.php as part of any URL request, thanks to the use of .htaccess mod_rewrite rules. If your server does not support mod_rewrite Blesta requires index.php to be included in all URLs. To force Blesta to include index.php in all URLs simply rename or delete the .htaccess file included with Blesta in your root web directory.

Changing the path to the Admin area

By default the path to the Admin area begins with /admin/. To change this locate routes.php in /installpath/config/routes.php and modify the value of the "Route.admin" configuration. For example, to change the path of the admin area to /staff/ set the following:

routes.php
Configure::set("Route.admin", "staff");

Changing the path to the Client area

By default the path to the Client area begins with /client/. To change this locate routes.php in /installpath/config/routes.php and modify the value of the "Route.client" configuration. For example, to change the path of the client area to /customers/ set the following:

routes.php
Configure::set("Route.client", "customers");

Forcing HTTPS

If your server supports mod_rewrite, you can enable HTTPS redirects by uncommenting the following lines (remove the '#' symbols) from the .htaccess file included with Blesta like the following:

.htaccess
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=307,NE,L]

NGINX Users

warning

Nginx should be used by experienced or advanced users only and is not suitable for beginners. If you are not familiar with Nginx, consider using Apache

  1. For pretty URL's (without /index.php/ in every URI) you will need to add a custom Nginx configuration. For a community provided example configuration, please see this thread or use the following example configuration as a basis for your own:
Show example Nginx config
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;

access_log /path/to/.logs/access.log main;
error_log /path/to/.logs/errors.log warn;

root /path/to/site/public;
index index.php index.html;

location / { try_files $uri $uri/ /index.php?q=$uri&$args; }

error_page 500 502 503 504 /50x.html;
location = /50x.html { root /var/lib/nginx/html; }

location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
}

location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ { expires 5d; }

if ($scheme != https) { return 307 https://domain.tld$request_uri; }
}

server {
listen 443 ssl;
listen [::]:443 ssl;
server_name _;

access_log /path/to/.logs/access.log main;
error_log /path/to/.logs/errors.log warn;

root /path/to/site/public;
index index.php index.html;

location / { try_files $uri $uri/ /index.php?q=$uri&$args; }

error_page 500 502 503 504 /50x.html;
location = /50x.html { root /var/lib/nginx/html; }

location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
}

location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ { expires 5d; }

ssl_certificate /etc/letsencrypt/live/domain.tld/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domain.tld/privkey.pem;
ssl_dhparam /etc/letsencrypt/dhparam.pem;

ssl_buffer_size 8k;

ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5;
ssl_prefer_server_ciphers on;

ssl_ecdh_curve secp384r1;
ssl_session_tickets off;

ssl_stapling on;
ssl_stapling_verify on;
resolver 8.8.8.8;

add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains; preload';

if ($host != domain.tld) { return 307 https://domain.tld$request_uri; }
}
  1. Next, update /core/ServiceProviders/MinphpBridge.php and make the following change:
// $htaccess = file_exists($rootWebDir . '.htaccess');
$htaccess = true;

Common Installation Issues

License Validation Issues

  • License does not seem to validate. I've confirmed that port 443 egress is open at my firewall at Curl SSL is installed.
    • Make sure mbstring.func_overload is off in your php.ini. Overloading single byte functions with mbstring multibyte functions will prevent encryption from working properly and your license will not validate.
    • Make sure that System.debug and errorReporting are both disabled in your ~/config/blesta.php config file. Both should look like the following toward the top of your config file:
      ~/config/blesta.php
      // WARNING: Enabling these can cause issues. Check ../logs_blesta/ logs instead
      Configure::errorReporting(0);
      // Override minPHP's debugging setting. true to enable debugging, false to disable it
      Configure::set('System.debug', false);