How to install Pimcore with Nginx on Ubuntu 24.04

This article guides users through installing Pimcore software with Nginx on Ubuntu 24.04. It details steps for setting up the Nginx web server, MariaDB database, and PHP, culminating in the installation of Pimcore. Additionally, it outlines Nginx configuration for Pimcore and securing the site with HTTPS via Let’s Encrypt.

This article explains installing Pimcore software with Nginx on Ubuntu 24.04.

Pimcore platform combines Product Information Management (PIM), Master Data Management (MDM), Content management (CMS), and eCommerce.

Setting up Pimcore with Nginx on Ubuntu Linux provides a robust platform for businesses that require a comprehensive content management system. Nginx is a high-performance web server that can handle high levels of concurrent connections, making it a great choice for serving web content.

When combined with Ubuntu Linux, a popular operating system for web servers, businesses can create a robust and reliable platform for hosting their website or eCommerce store.

Install Nginx HTTP server on Ubuntu

Pimcore requires a web server. This post will install and use the Nginx web server to run Pimcore.

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

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.

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

When you see the Welcome to nginx!, 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

The next component required to run Pimcore is a database server. This post will install and use the MariaDB database server.

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.

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.

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.

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.

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 Pimcore database

Upon successfully installing the MariaDB database server, create a blank database on the server specifically for the Pimcore application.

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

Finally, we’ll grant the pimcoredbuser full access to the pimcoredb database.

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

But first, log on to the MariaDB database server:

sudo mariadb

Then run the commands below to complete the steps:

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

Ensure to replace ‘type_your_password_here ‘with your password.

Install PHP on Ubuntu Linux

The last component you will need to run Pimcore is PHP. The Pimcore application is PHP-based and supports the latest versions of PHP.

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

sudo apt install php-fpm php-intl php-mysql php-curl php-cli php-zip php-xml php-gd php-common php-mbstring php-xmlrpc php-bcmath php-json php-sqlite3 php-soap php-zip

Additional help on installing PHP

How to install PHP on Ubuntu Linux

Get Pimcore files

Let’s start downloading and configuring the Pimcore files on Ubuntu Linux.

There are multiple ways to get Pimcore installed. For the free community version, the composer installer is the right choice.

First, install git, Composer, and other dependencies.

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

Next, change to the Nginx web server directory and clone Pimcore files. The last command allows the Nginx web server to interact safely with the files, ensuring a secure environment for your Pimcore installation.

cd /var/www/
sudo COMPOSER_MEMORY_LIMIT=-1 composer create-project pimcore/demo pimcore
sudo chown www-data:www-data -R /var/www/pimcore/

Note: Alternatively, install the skeleton copy if you do not want to install Pimcore with demo content.

sudo COMPOSER_MEMORY_LIMIT=-1 composer --ignore-platform-req=ext-amqp create-project pimcore/skeleton pimcore

After that, run the command below to install Pimcore.

cd /var/www/pimcore
sudo -u www-data ./vendor/bin/pimcore-install

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

You will be prompted to create an admin account, type the database and account created above to complete the installation.

Admin username:
> superadmin

Admin password (input will be hidden):
>

MySQL username:
> pimcoredbuser

MySQL password (input will be hidden):
>

MySQL database:
> pimcoredb

This will install Pimcore with the given settings. Do you want to continue? (yes/no) [yes]:
>

Running installation. You can find a detailed install log in var/installer/log/dev.log

Install complete!

11/11 [============================] 100%

Trying to install assets as relative symbolic links.

--- ------------------------------------------ ------------------
Bundle Method / Error
--- ------------------------------------------ ------------------
✔ FOSJsRoutingBundle relative symlink
✔ PimcoreAdminBundle relative symlink
✔ PimcoreCustomReportsBundle relative symlink
✔ PimcorePersonalizationBundle relative symlink
✔ PimcoreEcommerceFrameworkBundle relative symlink
✔ PimcoreApplicationLoggerBundle relative symlink
✔ PimcoreGoogleMarketingBundle relative symlink
✔ PimcoreCustomerManagementFrameworkBundle relative symlink
✔ PimcoreNewsletterBundle relative symlink
✔ PimcoreGlossaryBundle relative symlink
✔ PimcoreSeoBundle relative symlink
✔ PimcoreSimpleBackendSearchBundle relative symlink
✔ PimcoreDataHubBundle relative symlink
✔ OutputDataConfigToolkitBundle relative symlink
✔ Web2PrintToolsBundle relative symlink
✔ ObjectMergerBundle relative symlink
✔ PimcoreWebToPrintBundle relative symlink
✔ PimcoreTinymceBundle relative symlink
✔ PimcoreStaticRoutesBundle relative symlink
✔ PimcoreWordExportBundle relative symlink
✔ PimcoreXliffBundle relative symlink
✔ PimcoreCoreBundle relative symlink
--- ------------------------------------------ ------------------
[OK] All assets were successfully installed.
[OK] Pimcore was successfully installed

After Pimcore installation, continue below to set up Nginx to serve Pimcore’s content.

Run the commands below to create a Nginx virtual host file for Pimcore.

sudo nano /etc/nginx/sites-available/pimcore.conf

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

upstream php-pimcore {
server unix:/var/run/php/php8.3-fpm.sock;
}

map $args $static_page_root {
default /var/tmp/pages;
"~*(^|&)pimcore_editmode=true(&|$)" /var/nonexistent;
"~*(^|&)pimcore_preview=true(&|$)" /var/nonexistent;
"~*(^|&)pimcore_version=[^&]+(&|$)" /var/nonexistent;
}

map $uri $static_page_uri {
default $uri;
"/" /%home;
}

server {
listen 80;
listen [::]:80;
server_name pimcore.example.com;
root /var/www/pimcore/public;
index index.php;

access_log /var/log/nginx/forums-access.log;
error_log /var/log/nginx/forums-error.log;

location ~* ^/admin/external {
rewrite .* /index.php$is_args$args last;
}

location / {
error_page 404 /meta/404;
try_files $static_page_root$static_page_uri.html $uri /index.php$is_args$args;
}

location ~ ^/index\.php(/|$) {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
try_files $fastcgi_script_name =404;
include fastcgi.conf;
set $path_info $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_pass php-pimcore;
internal;
}
}

Save the file.

Then, run the commands below to enable the virtual host and restart the Nginx server.

sudo ln -s /etc/nginx/sites-available/pimcore.conf /etc/nginx/sites-enabled/
sudo systemctl restart nginx

Setup Let’s Encrypt SSL/TLS for Pimcore

You may want to install an SSL/TLS certificate to secure your Pimcore site. Secure your Pimcore installation with HTTPS from Let’s Encrypt.

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.

http://pimcore.example.com/

A Pimcore web portal page should appear.

To log on to the backend admin page, use the URL below.

http://pimcore.example.com/admin

That should do it!

Conclusion:

Setting up Pimcore on Ubuntu with Nginx is a streamlined process that equips businesses with a powerful content management system. To summarize:

  • Robust Platform: Pimcore integrates essential components like PIM, MDM, CMS, and eCommerce, offering a comprehensive solution for content management.
  • High Performance with Nginx: Utilizing Nginx enhances performance, allowing for high levels of concurrent connections and efficient resource management.
  • Easy Database Setup: Installing MariaDB and creating a dedicated database simplifies data management for Pimcore.
  • PHP Compatibility: Ensuring the latest version of PHP is installed guarantees optimal performance and support for the Pimcore application.
  • Secure Hosting: Implementing a virtual host and securing the installation with Let’s Encrypt SSL certificates ensures safety and reliability for users.

By following these guidelines, businesses can effectively manage their content and enhance their online presence with Pimcore.

Richard Avatar

Comments

Leave a Reply

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


Exit mobile version