How to Install Shopware with NGINX and Let's encrypt on Ubuntu 18.04 LTS
0

Shopware is the following era of open supply e-commerce software program. Primarily based on bleeding edge applied sciences like Symfony 3, Doctrine 2 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 Ubuntu 18.04 LTS system through the use of NGINX as an online server.

Necessities

Be sure that 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 increased 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 beneficial.
  • MySQL 5.5.Zero or increased.
  • Chance to arrange cron jobs.
  • Minimal Four GB obtainable laborious disk house.
  • IonCube Loader model 5.0.Zero or increased (optionally available).

NOTE: Shopware is presently as much as PHP 7.2.x suitable.

  • An working system working Ubuntu 18.04 LTS.
  • A non-root consumer with sudo privileges.

Preliminary steps

Examine your Ubuntu model:

lsb_release -ds
# Ubuntu 18.04.2 LTS

Arrange the timezone:

sudo dpkg-reconfigure tzdata

Replace your working system packages (software program). This is a crucial first step as a result of it ensures you may have the most recent updates and safety fixes to your working system’s default software program packages:

sudo apt replace && sudo apt improve -y

Set up some important packages which can be needed for fundamental administration of Ubuntu working system:

sudo apt set up -y curl wget vim git unzip socat bash-completion

Step 1 – Set up PHP and PHP extensions

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

sudo apt set up -y php7.2 php7.2-cli php7.2-fpm php7.2-common php7.2-mysql php7.2-curl php7.2-json php7.2-zip php7.2-gd php7.2-xml php7.2-mbstring php7.2-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.17-0ubuntu0.18.04.1 (cli) (constructed: Apr 18 2019 14:12:38) ( NTS )
# Copyright (c) 1997-2018 The PHP Group
# Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Applied sciences
# with Zend OPcache v7.2.17-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Applied sciences

PHP-FPM service is mechanically began and enabled on reboot on Ubuntu 18.04 system, so there is no such thing as a want to begin and allow it manually. We are able to transfer on to the following step, which is the IonCube Loader set up.

Step 2 – Set up IonCube Loader (optionally available)

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 working the command under:

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

Copy the ionCube Loader into the PHP extensions listing:

sudo cp /tmp/ioncube/ioncube_loader_lin_7.2.so /usr/lib/php/20170718/

Embody the loader by way of PHP configuration:

sudo vim /and many others/php/7.2/fpm/php.ini

Then add a line within the file to incorporate ionCube loader. It may be anyplace within the file under [PHP] line:

zend_extension = /usr/lib/php/20170718/ioncube_loader_lin_7.2.so

Save the file and restart PHP-FPM:

sudo systemctl restart php7.2-fpm.service

Step 3 – Set up MySQL and create a database for Shopware

Set up MySQL database server:

sudo apt set up -y mysql-server

Examine MySQL model:

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

Run mysql_secure set up script to enhance MySQL safety and set the password for MySQL root consumer:

sudo mysql_secure_installation

Reply every of the questions:

Would you prefer 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 take a look at database and entry to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

Hook up with MySQL shell as the basis consumer:

sudo mysql -u root -p
# Enter password

Create an empty MySQL database and consumer for Shopware and keep in mind the credentials:

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

Exit from MySQL:

mysql> exit

Change dbname, username and password with your individual names.

Step 4 – Set up Acme.sh shopper and procure Let’s Encrypt certificates (optionally available)

Securing your web site with HTTPS shouldn’t be needed, however it’s a good apply to safe your website visitors. So as to acquire a TLS certificates from Let’s Encrypt we’ll use acme.sh shopper. 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

If you’d like pretend certificates for testing you may add --staging flag to the above instructions.

After working the above instructions, your certificates and keys can be in:

  • For RSA: /dwelling/username/instance.com listing.
  • For ECC/ECDSA: /dwelling/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 many others/letsencrypt.

mkdir -p /and many others/letsecnrypt/instance.com
sudo mkdir -p /and many others/letsencrypt/instance.com_ecc

Set up/copy certificates to /and many others/letsencrypt listing.

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

All of the certificates can be mechanically renewed each 60 days.

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

exit

Step 5 – Set up and configure NGINX

Set up the NGINX net server:

sudo apt set up -y nginx

Examine the NGINX model:

sudo nginx -v
# nginx model: nginx/1.14.0 (Ubuntu)

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

server {
     pay attention 80;
     pay attention [::]:80;
     
     server_name instance.com;
     root /var/www/shopware;
 
     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 snippets/fastcgi-php.conf;
         fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
     }
 }

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

sudo ln -s /and many others/nginx/sites-available/shopware.conf /and many others/nginx/sites-enabled

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 www-data.

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

Enhance memory_limit = 256M and upload_max_filesize = 6M, and set allow_url_fopen = On if not already set in /and many others/php/7.2/fpm/php.ini file.

sudo vim /and many others/php/7.2/fpm/php.ini

After making adjustments in /and many others/php/7.2/fpm/php.ini file, reload php7.2-fpm.service:

sudo systemctl reload php7.2-fpm.service

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

Step 7 – Full the Shopware setup

Begin by choosing the language and click on Subsequent:

Shopware setup wizard

Subsequent, ensure you 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 just a few fundamental 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’ve got efficiently put in Shopware. Get pleasure from your new on-line store!

AMD to launch new 7nm Navi GPU, Rome CPU in third quarter

Previous article

HP Chromebook 14 evaluation: One of many first AMD Chromebooks, examined

Next article

You may also like

Comments

Leave a Reply

More in Apache