How to install Shopware with NGINX and encrypt on Fedora 30

How to install Shopware with NGINX and encrypt on Fedora 30

Shopware is the next generation of open source e-commerce software. Based on cutting-edge technologies such as Symfony 3, Doctrine2 Zend Framework Shopshop is the ideal platform for your next e-commerce project. This tutorial will use NGINX as a web server to guide you through the Shopware Community Edition (CE) installation on a Fedora 30 system.

Claim

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. It is highly recommended to use PHP 7.1 or higher.
  • MySQL 5.5.0 or higher.
  • Can set cron jobs.
  • At least 4 GB of free hard disk space.
  • IonCube Loader version 5.0.0 or higher (optional).

note: Shopware 5 is currently up PHP 7.2.x compatible.

prerequisites

  • An operating system running Fedora 29.
  • A non-root user with sudo privileges.

In this tutorial, I will use the domain name example.com. Please replace the word “example.com” with your own domain name in the commands and configuration files below (especially in the nginx configuration file and “Let’s Encrypt” command).

Preliminary steps

Check your Fedora version:

cat /etc/fedora-release# Fedora release 29 (Twenty Nine)

Set time zone:

timedatectl list-timezonessudo timedatectl set-timezone 'Region/City'

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

sudo dnf upgrade -y

Install some basic packages that are required for basic management of the Fedora operating system:

sudo dnf install -y curl wget vim git sudo unzip socat bash-completion

Step 1-install PHP and PHP extensions

Install PHP and the required PHP extensions for Shopware:

sudo dnf install -y php php-cli php-fpm php-common php-mysqlnd php-curl php-json php-zip php-gd php-xml php-mbstring php-opcache

To display PHP compiled in the module, run:

php -mctypecurlexiffileinfo. . .. . .

Check PHP version:

php --version# PHP 7.2.16 (cli) (built: Apr 30 2019 08:37:17) ( NTS )# Copyright (c) 1997-2018 The PHP Group# Zend Engine v3.3.5, Copyright (c) 1998-2018 Zend Technologies#    with Zend OPcache v7.3.5, Copyright (c) 1999-2018, by Zend Technologies

Start and enable the PHP-FPM service:

sudo systemctl start php-fpm.servicesudo systemctl enable php-fpm.service

We can move on to the next step, which is to install IonCube Loader.

Step 2-Install IonCube Loader (optional)

This step is optional because Shopware is now available without using IonCube, but there may still be extensions or themes that use IonCube, so installing it will not hurt. Download IonCube Loader:

cd /tmp && wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz

Extract loader:

tar xfz ioncube_loaders_lin_*.gz

Locate the PHP extension directory on your system by running the following command:

php -i | grep extension_dir# extension_dir => /usr/lib64/php/modules => /usr/lib64/php/modules

Copy the ionCube Loader into the PHP extension directory:

sudo cp /tmp/ioncube/ioncube_loader_lin_7.2.so /usr/lib64/php/modules

Include the loader via PHP configuration:

sudo vim /etc/php.ini

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

zend_extension = /usr/lib64/php/modules/ioncube_loader_lin_7.2.so

Save the file and restart PHP-FPM:

sudo systemctl restart php-fpm.service

Step 3-install MariaDB and create a database for Shopware

Install MariaDB database server:

sudo dnf install -y mariadb-server

Check MariaDB version:

mysql --version# mysql  Ver 15.1 Distrib 10.2.23-MariaDB, for Linux (x86_64) using readline 5.1

Start and enable MariaDB service:

sudo systemctl start mariadb.servicesudo systemctl enable mariadb.service

Run mysql_secure installation Script to improve MariaDB security and set MariaDB password root user:

sudo mysql_secure_installation

Answer each question:

Would you like to setup VALIDATE PASSWORD plugin? NNew password: your_secure_passwordRe-enter new password: your_secure_passwordRemove anonymous users? [Y/n] YDisallow root login remotely? [Y/n] YRemove test database and access to it? [Y/n] YReload privilege tables now? [Y/n] Y

Connect to MariaDB Shell as 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';mysql> FLUSH PRIVILEGES;

Exit from MariaDB:

mysql> exit

Replace dbname, username with password Use your own name.

Step 4-Install Acme.sh client and obtain Let’s Encrypt certificate (optional)

You don’t have to use HTTPS to protect your website, but it is a good habit to protect your website traffic. In order to obtain a TLS certificate from Let’s Encrypt, we will use the acme.sh client. Acme.sh is a pure Unix Shell software for obtaining TLS certificates from Let’s Encrypt with zero dependencies.

Download and install acme.sh:

sudo su - rootgit clone https://github.com/Neilpang/acme.sh.gitcd acme.sh ./acme.sh --install --accountemail [email protected]source ~/.bashrccd ~

Check the acme.sh version:

acme.sh --version# v2.8.1

Gain RSA with ECC / ECDSA Your domain / hostname certificate:

# RSA 2048acme.sh --issue --standalone -d example.com --keylength 2048# ECDSAacme.sh --issue --standalone -d example.com --keylength ec-256

If you want a fake certificate for testing, you can add --staging Mark the above command.

After running the above command, your certificate and key will be located at:

  • For RSA: /home/username/example.com table of Contents.
  • For ECC / ECDSA: /home/username/example.com_ecc table of Contents.

To list the certificates you issued, you can run:

acme.sh --list

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

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

Install / copy the certificate into the / etc / letsencrypt directory.

# RSAacme.sh --install-cert -d example.com --cert-file /etc/letsencrypt/example.com/cert.pem --key-file /etc/letsencrypt/example.com/private.key --fullchain-file /etc/letsencrypt/example.com/fullchain.pem --reloadcmd "sudo systemctl reload nginx.service"# ECC/ECDSAacme.sh --install-cert -d example.com --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 certificates will be automatically renewed every 60 days.

After obtaining the certificate, log out from the root user and return to the normal sudo user:

exit

Step 5-install and configure NGINX

Install NGINX Web Server:

sudo dnf install -y nginx

Check NGINX version:

nginx -v# nginx version: nginx/1.14.2

Start and enable the NGINX service:

sudo systemctl start nginx.servicesudo systemctl enable nginx.service

Configure NGINX for Shopware. Run sudo vim /etc/nginx/conf.d/shopware.conf And add the following configuration:

server {
    listen 80;
    listen [::]:80;
    
    server_name example.com;
    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 fastcgi.conf;
        fastcgi_pass unix:/run/php-fpm/www.sock;
    }
}

Check the NGINX configuration for syntax errors:

sudo nginx -t

Reload the NGINX service:

sudo systemctl reload nginx.service

Step 6-Install Shopware

Create a document root for Shopware:

sudo mkdir -p /var/www/shopware

Change ownership /var/www/shopware Directory to {your user}. Replace {your_user} with the username of the currently logged in user:

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

Navigate to the document root:

cd /var/www/shopware

Download and unzip the latest Shopware version via wget:

wget https://releases.shopware.com/install_5.5.8_d5bf50630eeaacc6679683e0ab0dcba89498be6d.zip?_ga=2.141661361.269357371.1556739808-1418008019.1556603459 -O shopware.zipunzip shopware.ziprm shopware.zip

note: If a newer version is available, update the download URL.

Change ownership /var/www/shopware Directory to nginx.

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

Run sudo vim /etc/php-fpm.d/www.conf And set users and groups to nginx. Initially, they will be set to apache:

sudo vim /etc/php-fpm.d/www.conf
user = nginxgroup = nginx

Create /var/lib/php/session/ Directory and change ownership to nginx.

sudo mkdir -p /var/lib/php/session && sudo chown -R nginx:nginx /var/lib/php/session

increase memory_limit = 256M with upload_max_filesize = 6MAnd set allow_url_fopen = On If not set /etc/php/7.2/fpm/php.ini file.

sudo vim /etc/php.ini

After making changes /etc/php.ini File, reload php-fpm.service:

sudo systemctl reload php-fpm.service

Open your domain / IP in a web browser and follow the installation wizard. Shopware’s backend is located /backend example: http://example.com/backend.

Step 7- complete Shopware setup

First select your language and click Next:

Next, ensure that all Shopware requirements are met:

Meet system requirements

Agree with Shopware TOS and click Next:

Accept license

Enter the database credentials and click Next:

Shopware database settings

Begin the installation to create the database tables:

Install database tables

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

Database initialized successfully

Select a license and click Next:

Select license

Fill in some basic settings to complete the settings, then click Next:

basic settings

The installation is complete.

The installation is complete

To access the management area, append / backend to your URL.

Shopware backend login

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

  • https://en.shopware.com/
  • https://github.com/shopware/shopware
Sidebar