This article explains how to install Zen Cart with Nginx on Ubuntu 24.04.
Zen Cart is an open-source e-commerce platform enabling users to create and manage online stores. It is designed to offer a user-friendly interface for store administrators and customers.
Nginx is known for its high performance and efficiency, especially when handling a large number of simultaneous connections. This can lead to faster load times for your Zen Cart store.
Using Nginx with Zen Cart on Ubuntu can lead to a more efficient, scalable, and secure e-commerce platform, enhancing the overall user experience for your customers.
Install Nginx HTTP server on Ubuntu
Zen Cart requires a web server. This post will install and use the Nginx web server to run Zen Cart.
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

The Nginx HTTP server has been installed when you see “Welcome to nginx!“.
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 Zen Cart 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 Zen Cart database
Upon successfully installing the MariaDB database server, create a blank database on the server specifically for the Zen Cart application.
As part of the setup, we will create a zencartdb database and a user account called zencartdbuser.
Finally, we’ll grant the zencartdbuser full access to the zencartdb 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 zencartdb CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER zencartdbuser@localhost IDENTIFIED BY 'type_your_password_here';
GRANT ALL ON zencartdb.* TO zencartdbuser@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 Zen Cart is PHP. The Zen Cart 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
Download Zen Cart files
Let’s begin downloading and configuring the Zen Cart files on Ubuntu Linux.
To always install the latest version, check the download page for Zen Cart. If a new version is available, replace the version number in the link below.
First, navigate to the /tmp/ directory and download Zen Cart files. After unzipping the file, move the content into the Zen Cart folder in the Nginx root directory.
The final step is to change the permissions. This will allow the Nginx web server to interact safely with the files, ensuring a secure environment for your Zen Cart installation.
cd /tmp/
wget https://github.com/zencart/zencart/archive/refs/tags/v2.0.1.zip
unzip v2.0.1.zip
sudo mv zencart-* /var/www/zencart
sudo chown -R www-data:www-data /var/www/zencart
Once you have completed all the above steps, continue configuring the Nginx web server below to serve the Zen Cart content.
Run the commands below to create a Zen Cart Nginx virtual host file.
sudo nano /etc/nginx/sites-available/zencart.conf
Then, copy and paste the content block below into the Nginx server block.
server {
listen 80;
listen [::]:80;
root /var/www/zencart;
index index.php;
server_name zencart.example.com;
access_log /var/log/nginx/example.com.access.log;
error_log /var/log/nginx/example.com.error.log;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
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/zencart.conf /etc/nginx/sites-enabled/
sudo systemctl restart nginx.service
Setup Let’s Encrypt SSL/TLS for Zen Cart
You may want to install an SSL/TLS certificate to secure your Zen Cart site. Secure your Zen Cart 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://zencart.example.com/install/
A Zen Cart installation wizard page should appear. Click on the “Click Here” link to begin the installation.

Accept the license agreement and continue with the setup.

Type in the database connection details created above and continue.

Create an admin account and continue

Complete the setup and start using your online store.

But first, run the command below to delete the installation folder.
sudo rm -rf /var/www/zencart/zc_install/
Launch your store.

That should do it!
Conclusion:
Installing Zen Cart with Nginx on Ubuntu provides an efficient and reliable platform for your e-commerce needs. Here are the key points to remember:
- Open-source Solution: Zen Cart offers a customizable and user-friendly interface for managing your online store.
- High Performance: Nginx ensures faster load times and better handling of simultaneous connections, enhancing user experience.
- Database Management: Utilizing MariaDB ensures a robust database solution that integrates seamlessly with Zen Cart.
- Latest Technologies: The installation leverages the latest PHP and Nginx configurations for optimal performance.
- Secure Installation: Implementing SSL/TLS with Let’s Encrypt adds an essential layer of security for online transactions.
- Follow Up: Regularly update your Zen Cart installation and components to maintain security and performance.
Following these steps will help you successfully launch and manage your online store with confidence.
Leave a Reply Cancel reply