How to Install Shopware with NGINX and Let's Encrypt on CentOS 7

Shopware is the subsequent era of open supply e-commerce software program. Primarily based on bleeding edge applied sciences like Symfony 3, Doctrine2 and Zend Framework Shopware comes as the proper platform to your subsequent e-commerce challenge. This tutorial will stroll you thru the Shopware Neighborhood Version (CE) set up on CentOS 7 system by utilizing NGINX as an online server.

Necessities

Ensure your system meets the next minimal necessities:

  • Linux-based working system with NGINX or Apache 2.x (with mod_rewrite) net server put in.
  • PHP 5.6.Four or greater 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 really helpful.
  • MySQL 5.5.Zero or greater.
  • Chance to arrange cron jobs.
  • Minimal Four GB out there laborious disk area.
  • IonCube Loader model 5.0.Zero or greater (non-obligatory).

NOTE: Shopware is at the moment as much as PHP 7.2.x suitable.

  • An working system operating CentOS 7.
  • A non-root person with sudo privileges.

Preliminary steps

Examine your CentOS model:

cat /and so on/centos-release

Arrange the timezone:

timedatectl list-timezones
sudo timedatectl set-timezone 'Area/Metropolis'

Replace your working system packages (software program). This is a vital first step as a result of it ensures you’ve the newest updates and safety fixes to your working system’s default software program packages:

sudo yum replace -y

Set up some important packages which are crucial for primary administration of the CentOS working system:

sudo yum set up -y curl wget vim unzip socat epel-release

Step 1 – Set up PHP and PHP extensions

Setup the Webtatic YUM repo:

sudo rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

Set up PHP, in addition to the mandatory PHP extensions for Shopware:

sudo yum set up -y php72w php72w-cli php72w-fpm php72w-common php72w-mysql php72w-curl php72w-json php72w-zip php72w-gd php72w-xml php72w-mbstring php72w-opcache

To indicate PHP compiled in modules, you may run:

php -m

ctype
curl
exif
fileinfo
. . .
. . .

Examine the PHP model:

php --version
# PHP 7.2.14 (cli) (constructed: Jan 12 2019 12:47:33) ( NTS )
# Copyright (c) 1997-2018 The PHP Group
# Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Applied sciences
# with Zend OPcache v7.2.14, Copyright (c) 1999-2018, by Zend Applied sciences

Begin and allow PHP-FPM service:

sudo systemctl begin php-fpm.service
sudo systemctl allow php-fpm.service

We are able to transfer on to the subsequent step, which is the IonCube Loader set up.

Step 2 – Set up IonCube Loader (non-obligatory)

Obtain IonCube Loader:

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

Extract the loader:

tar xfz ioncube_loaders_lin_*.gz

Discover the PHP extensions listing on the system by operating the command beneath:

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

Copy the ionCube Loader into the PHP extensions listing:

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

Embrace the loader by way of PHP configuration:

sudo vim /and so on/php.ini

Then add a line within the file to incorporate ionCube loader. It may be wherever within the file beneath [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 – Set up MariaDB and create a database for Shopware

Set up MariaDB database server:

sudo yum set up -y mariadb-server

Examine the MariaDB model:

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

Begin and allow MariaDB service:

sudo systemctl begin mariadb.service
sudo systemctl allow mariadb.service

Run mysql_secure set up script to enhance MariaDB safety and set the password for MariaDB root person:

sudo mysql_secure_installation

Reply every of the questions:

Would you wish to setup VALIDATE PASSWORD plugin? N
New password: your_secure_password
Re-enter new password: your_secure_password
Take away nameless customers? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Take away check database and entry to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

Hook up with MariaDB shell as the foundation person:

sudo mysql -u root -p
# Enter password

Create an empty MariaDB database and person for Shopware and bear in mind the credentials:

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

Exit from MariaDB:

mysql> exit

Change dbname, username and password with your individual names.

Step 4 – Set up Acme.sh consumer and acquire Let’s Encrypt certificates (non-obligatory)

Securing your web site with HTTPS is just not crucial, however it’s a good observe to safe your website visitors. To be able to get hold of a TLS certificates from Let’s Encrypt we are going to use acme.sh consumer. Acme.sh is a pure Unix shell software program for acquiring TLS certificates from Let’s Encrypt with zero dependencies.

Obtain and set up acme.sh:

sudo su - root
git clone https://github.com/Neilpang/acme.sh.git
cd acme.sh
./acme.sh --install --accountemail [email protected]
supply ~/.bashrc
cd ~

Examine acme.sh model:

acme.sh --version
# v2.8.1

Get hold of RSA and ECC/ECDSA certificates to your area/hostname:

# RSA 2048
acme.sh --issue --standalone -d instance.com --keylength 2048
# ECDSA
acme.sh --issue --standalone -d instance.com --keylength ec-256

In order for you faux certificates for testing you may add –staging flag to the above instructions.

After operating the above instructions, your certificates and keys might be in:

  • For RSA: /residence/username/instance.com listing.
  • For ECC/ECDSA: /residence/username/instance.com_ecc listing.

To record your issued certs you may run:

acme.sh --list

Create a listing to retailer your certs. We are going to use a listing /and so on/letsencrypt.

mkdir -p /and so on/letsecnrypt/instance.com
sudo mkdir -p /and so on/letsencrypt/instance.com_ecc

Set up/copy certificates to /and so on/letsencrypt listing.

# RSA
acme.sh --install-cert -d instance.com --cert-file /and so on/letsencrypt/instance.com/cert.pem --key-file /and so on/letsencrypt/instance.com/personal.key --fullchain-file /and so on/letsencrypt/instance.com/fullchain.pem --reloadcmd "sudo systemctl reload nginx.service"
# ECC/ECDSA
acme.sh --install-cert -d instance.com --ecc --cert-file /and so on/letsencrypt/instance.com_ecc/cert.pem --key-file /and so on/letsencrypt/instance.com_ecc/personal.key --fullchain-file /and so on/letsencrypt/instance.com_ecc/fullchain.pem --reloadcmd "sudo systemctl reload nginx.service"

All of the certificates might be robotically renewed each 60 days.

After acquiring certs exit from root person and return again to regular sudo person:

exit

Step 5 – Set up and configure NGINX

Set up the NGINX net server:

sudo yum set up -y nginx

Examine the NGINX model:

nginx -v

Begin and allow Nginx service:

sudo systemctl begin nginx.service
sudo systemctl allow nginx.service

Configure NGINX for Shopware. Run sudo vim /and so on/nginx/conf.d/shopware.conf and add the next configuration:

server {
     pay attention 80;
     pay attention 443 ssl;
     
     server_name instance.com;
     root /var/www/shopware;
ssl_certificate /and so on/letsencrypt/instance.com/fullchain.cer;
ssl_certificate_key /and so on/letsencrypt/instance.com/instance.com.key;
ssl_certificate /and so on/letsencrypt/instance.com_ecc/fullchain.cer;
ssl_certificate_key /and so on/letsencrypt/instance.com_ecc/instance.com.key;
index shopware.php index.php; location / { try_files $uri $uri/ /shopware.php$is_args$args; } location /restoration/set up { index index.php; try_files $uri /restoration/set up/index.php$is_args$args; } location ~ .php$ { embody fastcgi.conf; fastcgi_pass 127.0.0.1:9000; } }

Examine NGINX configuration for syntax errors:

sudo nginx -t

Reload NGINX service:

sudo systemctl reload nginx.service

Step 6 – Set up Shopware

Create a doc root listing for Shopware:

sudo mkdir -p /var/www/shopware

Change possession of the /var/www/shopware listing to {jour_user}:

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

Navigate to the doc root listing:

cd /var/www/shopware

Obtain and unzip the newest Shopware launch by way of wget:

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

NOTE: Replace obtain URL if there’s a newer launch.

Change possession of the /var/www/shopware listing to nginx.

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

Run sudo vim /and so on/php-fpm.d/www.conf and set person and group to nginx.

sudo vim /and so on/php-fpm.d/www.conf
# person = nginx
# group = nginx

Create /var/lib/php/session listing and alter its possession to a person nginx.

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

Improve memory_limit = 256M and upload_max_filesize = 6M, and set allow_url_fopen = On if not already set in /and so on/php.ini file.

sudo vim /and so on/php.ini

After making adjustments in /and so on/php.ini file, reload php-fpm.service:

sudo systemctl reload php-fpm.service

Open your area/IP within the net browser and observe the set up wizard. The backend of Shopware is situated at /backend instance: http://example.com/backend.

Step 7 – Full the Shopware setup

Begin by deciding on the language and click on Subsequent:

Shopware setup wizard

Subsequent, be sure to meet all of the Shopware necessities:

System requirements are met

Agree with Shopware TOS and click on Subsequent:

Accept license

Enter database credentials and click on Subsequent:

Shopware database settings

Begin the set up to create database tables:

Installing database tables

After that, you will note a message about profitable database import:

Database initialization successful

Select a license and click on Subsequent:

Choose license

Fill in a couple of primary settings to complete up the setup and click on Subsequent:

Basic settings

Set up is full.

Installation is complete

To entry admin space append /backend to your URL.

Shopware backend login

You have got efficiently put in Shopware. Take pleasure in your new on-line store!

LEAVE A REPLY

Please enter your comment!
Please enter your name here