How To

Install PrestaShop on Ubuntu 18.04 with Nginx and MySQL

PrestaShop is a free, open-source e-commerce platform built with PHP and MySQL. It comes with a clean admin dashboard, support for multiple payment gateways, multi-language storefronts, and built-in reporting. You can extend it further with free and paid plugins and themes.

This guide shows you how to install PrestaShop on Ubuntu 18.04 using Nginx as the web server.

<strong>Prerequisites:</strong>&nbsp;Nginx installed with an SSL certificate, a domain name pointing to your server, and sudo access. Prepare your system with&nbsp;<code>sudo apt update &amp;&amp; sudo apt upgrade &amp;&amp; sudo apt install unzip</code>.

Create the MySQL Database

PrestaShop needs a database to store products, orders, and customer data.

Install MySQL if it is not already on your server:

bashsudo apt install mysql-server mysql-client

For fresh installations, run mysql_secure_installation first to remove test accounts and restrict remote root access.

Log in to the MySQL shell:

bashsudo mysql

Create a dedicated database and user for PrestaShop:

sqlCREATE DATABASE prestashop;GRANT ALL ON prestashop.* TO 'prestashop'@'localhost' IDENTIFIED BY 'StrongPassword';EXIT;

Always use a strong, unique password for any database user account.

Install and Configure PHP 7.2

PHP 7.2 is the default version in Ubuntu 18.04 and is fully supported by PrestaShop.

Install PHP and all required extensions:

bashsudo apt install php7.2-common php7.2-cli php7.2-fpm php7.2-opcache php7.2-gd php7.2-mysql php7.2-curl php7.2-intl php7.2-xsl php7.2-mbstring php7.2-zip php7.2-bcmath php7.2-soap

The extensions cover image processing (gd), database connections (mysql), internationalization (intl), and XML handling (xsl). All are required for PrestaShop to work correctly.

Apply the recommended PHP settings:

bashsudo sed -i "s/memory_limit = .*/memory_limit = 1024M/" /etc/php/7.2/fpm/php.inisudo sed -i "s/upload_max_filesize = .*/upload_max_filesize = 256M/" /etc/php/7.2/fpm/php.inisudo sed -i "s/max_execution_time = .*/max_execution_time = 18000/" /etc/php/7.2/fpm/php.ini

Download PrestaShop and Set Permissions

Download the latest PrestaShop release and create the web root:

bashcd /tmpwget https://download.prestashop.com/download/releases/prestashop_1.7.6.2.zipsudo mkdir -p /var/www/html/example.com

Extract the archive. The outer zip contains a second zip file inside it — extract that one into your web root:

bashunzip prestashop_*.zipsudo unzip prestashop.zip -d /var/www/html/example.com

Set the correct ownership so Nginx can read all site files:

bashsudo chown -R www-data: /var/www/html

Configure Nginx for PrestaShop

Create a server block at /etc/nginx/sites-available/example.com. The configuration must include:

  • root /var/www/html/example.com
  • index index.php
  • server_name example.com www.example.com
  • Your Let’s Encrypt SSL certificate paths
  • A fastcgi_pass directive pointing to unix:/run/php/php7.2-fpm.sock

Find your PrestaShop admin folder name and add a matching location block for it:

bashsudo ls -l /var/www/html/example.com | grep admin

Test the configuration and restart Nginx:

bashsudo nginx -tsudo systemctl restart nginx

Complete the Installation via Web Browser

Open your browser and go to https://example.com. The PrestaShop setup wizard will open.

Work through each step:

  1. Choose your language and accept the license agreement
  2. Check that all pre-installation requirements show green
  3. Enter your store name and admin email address
  4. Enter the MySQL database credentials you created earlier

The installer will confirm when setup is complete. Delete the install folder right away for security:

bashsudo rm -rf /var/www/html/example.com/install

Log in to the admin panel using your email and password to start building your store.

PrestaShop is now live on your Ubuntu 18.04 server. Add your products, configure payment methods, and set up shipping rules from the admin panel. Leave a comment below if you run into any errors during installation.

Cyber Defence

Recent Posts

Install Tomcat 9 on Ubuntu 18.04: Systemd Service Setup Guide

Apache Tomcat is an open-source Java application server that implements the Java Servlet, JavaServer Pages, and…

4 minutes ago

Change Timezone on Ubuntu 18.04: Command Line and GUI Methods

Setting the correct timezone on your Ubuntu machine is more important than it sounds. Your…

7 minutes ago

Set Up SSH Keys on Ubuntu 18.04: Passwordless Login Guide

SSH keys give you a more secure and convenient way to connect to remote servers. Instead…

28 minutes ago

Install FFmpeg on Ubuntu 18.04: apt, Snap, and Usage Examples

FFmpeg is a free, open-source command-line tool for working with multimedia files. It can convert video…

31 minutes ago

Set Up Nginx Server Blocks on Ubuntu 18.04: Host Multiple Sites

Nginx server blocks let you run more than one website on a single server. Each block…

23 hours ago

Install Tor Browser on Ubuntu 18.04: Anonymous Browsing Guide

Tor Browser is a modified version of Firefox that routes all your web traffic through the Tor…

23 hours ago