How to Install Shopware with NGINX and Let's encrypt on Debian 9

Shopware is a widely used professional open source e-commerce software. Based on bleeding edge technologies like Symfony 3, Doctrine2 and Zend Framework Shopware comes as the perfect platform for your next e-commerce project. This tutorial will show you how to install Shopware Community Edition (CE) on a Debian 9 system by using NGINX as a web server and how to secure the website with a free Let's encrypt SSL certificate.


Make sure your system meets the following minimum requirements:

  • Linux-based operating system with NGINX or Apache 2.x (with mod_rewrite) web server installed.
  • PHP 5.6.4 or higher with ctype, gd, curl, dom, hash, iconv, zip, json, mbstring, openssl, session, simplexml, xml, zlib, fileinfo, and pdo/mysql extensions. PHP 7.1 or above is strongly recommended.
  • MySQL 5.5.0 or higher.
  • Possibility to set up cron jobs.
  • Minimum 4 GB available hard disk space.
  • IonCube Loader version 5.0.0 or higher (optional).

NOTE: Shopware is currently up to PHP 7.2.x compatible.


  • An operating system running Debian 9.
  • A non-root user with sudo privileges.

Initial steps

Check your Debian version:

lsb_release -ds
# Debian GNU/Linux 9.8 (stretch)

Set up the timezone:

sudo dpkg-reconfigure tzdata

Update your operating system packages (software). This is an important first step because it ensures you have the latest updates and security fixes for your operating system's default software packages:

sudo apt update && sudo apt upgrade -y

Install some essential packages that are necessary for basic administration of the Debian operating system:

sudo apt install -y curl wget vim git unzip socat apt-transport-https

Step 1 - Install PHP and PHP extensions

Install PHP, as well as the necessary PHP extensions for Shopware:

sudo apt install -y php7.0 php7.0-cli php7.0-fpm php7.0-common php7.0-mysql php7.0-curl php7.0-json php7.0-zip php7.0-gd php7.0-xml php7.0-mbstring php7.0-opcache

To show PHP compiled in modules, you can run:

php -m

. . .
. . .

Check the PHP version:

php --version

# PHP 7.0.30-0+deb9u1 (cli) (built: Jun 14 2018 13:50:25) ( NTS )
# Copyright (c) 1997-2018 The PHP Group
# Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
# with Zend OPcache v7.2.15-0debian0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies

PHP-FPM service is automatically started and enabled on reboot on Debian 9 system, so there is no need to start and enable it manually. We can move on to the next step, which is the IonCube Loader installation.

Step 2 - Install IonCube Loader (optional)

Download IonCube Loader:

cd /tmp && wget

Extract the loader:

tar xfz ioncube_loaders_lin_*.gz

Find the PHP extensions directory on the system by running the command below:

php -i | grep extension_dir
# extension_dir => /usr/lib/php/20170718 => /usr/lib/php/20170718

Copy the ionCube Loader into the PHP extensions directory:

sudo cp /tmp/ioncube/ /usr/lib/php/20170718/

Include the loader via PHP configuration:

sudo vim /etc/php/7.0/fpm/php.ini

Then add a line in the file to include ionCube loader. It can be anywhere in the file below [PHP] line:

zend_extension = /usr/lib/php/20170718/

Save the file and restart PHP-FPM:

sudo systemctl restart php7.0-fpm.service

Step 3 - Install MariaDB and create a database for Shopware

Install MariaDB database server:

sudo apt install -y mariadb-server

Check MariaDB version:

mysql --version
# mysql Ver 14.14 Distrib 5.7.26, for Linux (x86_64) using EditLine wrapper

Run mysql_secure installation script to improve MariaDB security and set the password for MariaDB root user:

sudo mysql_secure_installation

Answer each of the questions:

Would you like to setup VALIDATE PASSWORD plugin? N
New password: your_secure_password
Re-enter new password: your_secure_password
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

Connect to MariaDB shell as the root user:

sudo mysql -u root -p
# Enter password

Create an empty MariaDB database and user for Shopware and remember the credentials:

mysql> CREATE DATABASE dbname;
mysql> GRANT ALL ON dbname.* TO 'username' IDENTIFIED BY 'password';

Exit from MariaDB:

mysql> exit

Replace dbname, username and password with your own names.

Step 4 - Install client and obtain Let's Encrypt certificate (optional)

Securing your website with HTTPS is not necessary, but it is a good practice to secure your site traffic. In order to obtain a TLS certificate from Let's Encrypt we will use client. is a pure Unix shell software for obtaining TLS certificates from Let's Encrypt with zero dependencies.

Download and install

sudo su - root
git clone
./ --install --accountemail [email protected]
source ~/.bashrc
cd ~

Check version: --version
# v2.8.1

Obtain RSA and ECC/ECDSA certificates for your domain/hostname:

# RSA 2048 --issue --standalone -d --keylength 2048
# ECDSA --issue --standalone -d --keylength ec-256

If you want fake certificates for testing you can add --staging flag to the above commands.

After running the above commands, your certificates and keys will be in:

  • For RSA: /home/username/ directory.
  • For ECC/ECDSA: /home/username/example.com_ecc directory.

To list your issued certs you can run: --list

Create a directory to store your certs. We will use a directory /etc/letsencrypt.

mkdir -p /etc/letsecnrypt/
sudo mkdir -p /etc/letsencrypt/example.com_ecc

Install/copy certificates to /etc/letsencrypt directory.

# RSA --install-cert -d --cert-file /etc/letsencrypt/ --key-file /etc/letsencrypt/ --fullchain-file /etc/letsencrypt/ --reloadcmd "sudo systemctl reload nginx.service"
# ECC/ECDSA --install-cert -d --ecc --cert-file /etc/letsencrypt/example.com_ecc/cert.pem --key-file /etc/letsencrypt/example.com_ecc/private.key --fullchain-file /etc/letsencrypt/example.com_ecc/fullchain.pem --reloadcmd "sudo systemctl reload nginx.service"

All the certificates will be automatically renewed every 60 days.

After obtaining certs exit from root user and return back to normal sudo user:


Step 5 - Install and configure NGINX

Install the NGINX web server:

sudo apt install -y nginx

Check the NGINX version:

sudo nginx -v
# nginx version: nginx/1.10.3

Configure NGINX for Shopware. Run sudo vim /etc/nginx/sites-available/shopware.conf and add the following configuration:

server {
    listen 80;
    listen 443 ssl;

ssl_certificate /etc/letsencrypt/;
ssl_certificate_key /etc/letsencrypt/;
ssl_certificate /etc/letsencrypt/example.com_ecc/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/example.com_ecc/private.key; server_name; root /var/www/shopware; index shopware.php index.php; location / { try_files $uri $uri/ /shopware.php$is_args$args; } location /recovery/install { index index.php; try_files $uri /recovery/install/index.php$is_args$args; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; } }

Activate the new shopware.conf configuration by linking the file to the sites-enabled directory:

sudo ln -s /etc/nginx/sites-available/shopware.conf /etc/nginx/sites-enabled

Check NGINX configuration for syntax errors:

sudo nginx -t

Reload NGINX service:

sudo systemctl reload nginx.service

Step 6 - Install Shopware

Create a document root directory for Shopware:

sudo mkdir -p /var/www/shopware

Change ownership of the /var/www/shopware directory to {jour_user}:

sudo chown -R {your_user}:{your_user} /var/www/shopware

Navigate to the document root directory:

cd /var/www/shopware

Download and unzip the latest Shopware release via wget:

wget -O

NOTE: Update download URL if there is a newer release.

Change ownership of the /var/www/shopware directory to www-data.

sudo chown -R www-data:www-data /var/www/shopware

Increase memory_limit = 256M and upload_max_filesize = 6M, and set allow_url_fopen = On if not already set in /etc/php/7.0/fpm/php.ini file.

sudo vim /etc/php/7.0/fpm/php.ini

After making changes in /etc/php/7.0/fpm/php.ini file, reload php7.0-fpm.service:

sudo systemctl reload php7.0-fpm.service

Open your domain/IP in the web browser and follow the installation wizard. The backend of Shopware is located at /backend example:

Step 7 - Complete the Shopware setup

Start by selecting the language and click Next:

Shopware setup wizard

Next, make sure you meet all the Shopware requirements:

System requirements are met

Agree with Shopware TOS and click Next:

Accept license

Enter database credentials and click Next:

Shopware database settings

Start the installation to create database tables:

Installing database tables

After that, you will see a message about successful database import:

Database initialization successful

Choose a license and click Next:

Choose license

Fill in a few basic settings to finish up the setup and click Next:

Basic settings

Installation is complete.

Installation is complete

To access admin area append /backend to your URL.

Shopware backend login

You have successfully installed Shopware. Enjoy your new online shop!

Share this page:

Suggested articles

0 Comment(s)

Add comment