How To Install Shopware on CentOS 7 – Step by Step

Install Shopware on CentOS 7

Shopware is a free and open source e-commerce application written in PHP. It uses MySQL as the database server to store the data. Shopware is very easy to use and require no coding knowledge to work. It is secure and responsive. The application provides the interface for elements to drag and drop, it also supports design grids. It contains story telling, slide shows, and quick views. In this tutorial we will learn how to Install Shopware on CentOS 7.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root accge of Linount, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation Shopware on a CentOS 7 server.

Install Shopware on CentOS 7

Step 1. First let’s start by ensuring your system is up-to-date.

yum clean all
yum -y update

Step 2. Install LAMP server.

A CentOS 7 LAMP stack server is required. If you do not have LAMP installed, you can follow our guide here. Also install required PHP modules:

yum -y install php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-mssql php-snmp php-soap php-tidy curl curl-devel

Step 3. Installing Shopware on CentOS.

Go to the root directory of your system and download the latest stable version of Shopware:

wget https://codeload.github.com/shopware/shopware/zip/5.5
unzip v5.5.zip -d /var/www/html
cd /var/www/html/shopware-5.5 cp -a * ..

We will need to change some folders permissions:

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

Step 4. Configuring MariaDB for Shopware.

By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation script. You should read and below each steps carefully which will set root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB.

mysql_secure_installation

Configure it like this:

- Set root password? [Y/n] y
- 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

Next we will need to log in to the MariaDB console and create a database for the Shopware. Run the following command:

mysql -u root -p

This will prompt you for a password, so enter your MariaDB root password and hit Enter. Once you are logged in to your database server you need to create a database for Shopware installation:

CREATE DATABASE shopware;
GRANT ALL PRIVILEGES ON shopware.* TO 'shopware'@'localhost' IDENTIFIED BY 'strong_password';
FLUSH PRIVILEGES;
\q

Step 5. Configuring Apache for Shopware.

We will create Apache virtual host for your Shopware website. First create ‘/etc/httpd/conf.d/vhosts.conf’ file with using a text editor of your choice:

nano /etc/httpd/conf.d/vhosts.conf
IncludeOptional vhosts.d/*.conf

Next, create the virtual host:

mkdir /etc/httpd/vhosts.d/
nano /etc/httpd/vhosts.d/yourdomain.com.conf

Add the following lines:

<VirtualHost YOUR_SERVER_IP:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html
ServerName yourdomain.com
ServerAlias www.yourdomain.com
ErrorLog "/var/log/httpd/yourdomain.com-error_log"
CustomLog "/var/log/httpd/yourdomain.com-access_log" combined

<Directory "/var/www/html/">
DirectoryIndex index.html index.php
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

Save and close the file. Restart the Apache service for the changes to take effects:

systemctl restart httpd.service

Step 6. Accessing Shopware e-commerce.

Shopware will be available on HTTP port 80 by default. Open your favorite browser and navigate to http://yourdomain.com or http://server-ip and complete the required the steps to finish the installation. If you are using a firewall, please open port 80 to enable access to the control panel.

Congratulation’s! You have successfully installed Shopware. Thanks for using this tutorial for installing Shopware community edition on CentOS 7 systems. For additional help or useful information, we recommend you to check the official Shopware website.

How To Setup a NGINX Virtual Host – Easy Guide

In this tutorial we are going to learn how to install and configuration of virtual hosts “Server Blocks” Nginx on your Linux server. Virtual hosts such as nginx are used for running two or more domains or websites using just one server which you can learn more about in this hosting fundamentals course. Here’s a brief tutorial that shows you how to create a virtual host or server block on Nginx web server. This guide assumes that you’ve been following along from the previous tutorial: How to Install and Configure a NGINX Server.

Setup a NGINX Virtual Host

Create a New Directory

cd /var/www
mkdir -p wpcademy.com/{public_html,logs,stats}
mkdir -p wpcademy.com/{public_html,logs,stats}
Create vhost conf file
#nano /etc/nginx/conf.d/wpcademy.com.conf

server {
   listen  80;
   server_name  wpcademy.com www.wpcademy.com;
 
   access_log  /var/www/wpcademy.com/logs/access.log ;
   error_log    /var/www/wpcademy.com/logs/error.log ;
 
   location / {
       root   /var/www/wpcademy.com/public_html;
       index  index.php index.html index.htm;
 
   }
 
   error_page   500 502 503 504  /50x.html;
   location = /50x.html {
       root   /var/www/wpcademy.com/public_html;
   }
 
  # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  location ~ .php$ {
fastcgi_pass   127.0.0.1:9000;
fastcgi_index  index.php;
root    /var/www/wpcademy.com/public_html;
fastcgi_param  SCRIPT_FILENAME  /var/www/wpcademy.com/public_html$fastcgi_script_name;
include fastcgi_params;
}
 
 
   location ~ /.ht {
       deny  all;
   }
}
# nano /etc/nginx/conf.d/wpcademy.com.conf
server {
   listen  80;
   server_name  wpcademy.com www.wpcademy.com;
 
   access_log  /var/www/wpcademy.com/logs/access.log ;
   error_log    /var/www/wpcademy.com/logs/error.log ;
 
   location / {
       root   /var/www/wpcademy.com/public_html;
       index  index.php index.html index.htm;
 
   }
 
   error_page   500 502 503 504  /50x.html;
   location = /50x.html {
       root   /var/www/wpcademy.com/public_html;
   }
 
  # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  location ~ .php$ {
fastcgi_pass   127.0.0.1:9000;
fastcgi_index  index.php;
root    /var/www/wpcademy.com/public_html;
fastcgi_param  SCRIPT_FILENAME  /var/www/wpcademy.com/public_html$fastcgi_script_name;
include fastcgi_params;
}
 
   location ~ /.ht {
       deny  all;
   }
}

Add vhost on nginx.conf

# nano /etc/nginx/nginx.conf
### add line like this on http section:
include /etc/nginx/conf.d/*.conf;

Restarting nginx and php-fpm

# /etc/init.d/nginx restart
# /etc/init.d php-fpm restart

Note: Please make sure that all the domain names are propagated and are properly directed to your servers ip address, if not you will not able able to check if your new configuration works or not.

Congratulation’s! You have successfully installed server blocks Nginx. Thanks for using this tutorial for installing Virtual hosts Nginx on Linux system. For additional help or useful information, we recommend you to check the official Nginx web site

How To Install Iftop Network Bandwidth Monitoring on Linux

Install Iftop Network Bandwidth Monitoring on Linux

iftop is a command line tool that shows a list of active network connections between local host and any remote host, sorted by their bandwidth usage. The list of top-ranking network connections (in terms of bandwidth usage) is periodically refreshed in a ncurses-based user interface.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation Iftop Network Bandwidth Monitoring on a Linux server.

Install Iftop Network Bandwidth Monitoring on Linux

Step 1. First make sure that all your system packages are up-to-date by running these following apt-get commands in the terminal.

### CentOS ###
sudo yum clean all
sudo yum -y update

### Ubuntu ###
sudo apt-get update
sudo apt-get upgrade

Step 2. Installing Interface TOP (IFTOP) on Linux.

To install iftop on Ubuntu, Mint or Debian:

sudo apt-get install iftop

To install iftop on CentOS:

sudo yum install epel-release
sudo yum install iftop

Step 3. Using IFTOP.

iftop is very simple to use. Just type the iftop command on terminal with root privileges to display the bandwidth usage of the first network interface. Press Q to exit from the iftop command output:

iftop

Congratulation’s! You have successfully installed Interface TOP (IFTOP). Thanks for using this tutorial for installing Iftop Network Bandwidth Monitoring on Ubuntu 18.04 LTS (Bionic Beaver) system. For additional help or useful information, we recommend you to check the official iftop web site.

How to use Linux and Unix TAR Command

Linux and Unix TAR Command

The tar command used to rip a collection of files and directories into highly compressed archive file commonly called tarball or tar, gzip and bzip in Linux. The tar is most widely used command to create compressed archive files and that can be moved easily from one disk to anther disk or machine to machine. The main purpose of this article is to provide various tar command examples that might be helpful you to understand and become expert in tar archive manipulation. In this tutorial we will learn how to use Linux and UNIX TAR command.

Linux and Unix TAR Command

Create tar Archive File

Example command create a tar archive file wpcademy.tar for a directory /home/wpcademy in current working directory.

#tar -cvf wpcademy.tar /home/wpcademy/

/home/wpcademy/
/home/wpcademy/install.sh
/home/wpcademy/openvpn-2.0.9-1.tar.gz

Create tar.gz Archive File

Example command create a compressed gzip archive file wpcademy.tar for a directory /home/wpcademy in current working directory.

#tar cvzf Mythemes.tar.gz /home/wpcademy

/home/wpcademy/
/home/wpcademy/kardun
/home/wpcademy/eleganthemes
/home/wpcademy/adsready

Untar a tar File or gzip-bz2 tar File

#tar xvzf wpcademy.gz - for uncompress a gzip tar file (.tgz or .tar.gz)
#tar xvjf wpcademy.tar.bz2 - for uncompress a bzip2 tar file (.tbz or .tar.bz2)
#tar xvf wpcademy.tar - for uncompressed tar file (.tar)

Tar Command Options

c – create a archive file.
x – extract a archive file.
v – show the progress of archive file.
f – filename of archive file.
t – viewing content of archive file.
j – filter archive through bzip2.
z – filter archive through gzip.
r – append or update files or directories to existing archive file.
W – Verify a archive file.

How To Install FFmpeg and FFmpeg-PHP Extension on CentOS

Install FFmpeg and FFmpeg-PHP Extension on CentOS

FFmpeg is a cross-platform solution for streaming audio and video as well as recording and conversion. There’s also a great PHP package called ffmpeg-php that allows for easy use of FFmpeg from inside PHP scripts. In this tutorial we will learn Install FFmpeg and FFmpeg-PHP Extension on CentOS server.

Install FFmpeg on CentOS

Step 1. To install, first you must add the DAG yum repository information corresponding to your CentOS/RHEL version to yum:

 #nano /etc/yum.repos.d/dag.repo

Add the following text to the file and save:

[dag]
name=DAG RPM Repository
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1

Step 2. After add Dag repository, Use yum to install ffmpeg using following command.

#<code>rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
#yum install ffmpeg ffmpeg-devel ffmpeg-libpostproc

 

FFmpeg Basic Commands

#ffmpeg -version:            show version
#ffmpeg -formats:            show available formats
#ffmpeg -codecs:             show available codecs
#ffmpeg -decoders:           show available decoders
#ffmpeg -encoders:           show available encoders
#ffmpeg -bsfs:               show available bit stream filters
#ffmpeg -protocols:          show available protocols
#ffmpeg -pix_fmts:           show available pixel formats
#ffmpeg -layouts:            show standard channel layouts
#ffmpeg -sample_fmts:        show available audio sample formats
#ffmpeg -filters:            show available filters

 Install FFmpeg-PHP Extension on CentOS

Step 1.

 #yum install php-gd php-devel

Step 2.Download the latest ffmpeg-php release

#wget http://nchc.dl.sourceforge.net/project/ffmpeg-php/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2
#tar -xjf ffmpeg-php-0.6.0.tbz2
#cd ffmpeg-php-0.6.0
#phpize
#./configure
#make
#make install

If you get  [ffmpeg_movie.lo] Error 1 when compiling ffmpeg-php, then you will need to do:

#nano ffmpeg_movie.c
Changes in ffmpeg_movie.c:
#row 311: list_entry *le; to zend_rsrc_list_entry *le;
#row 346: list_entry new_le; to zend_rsrc_list_entry new_le;
#row 360: hashkey_length+1, (void *)&new_le, sizeof(list_entry), to hashkey_length+1, (void *)&new_le,sizeof(zend_rsrc_list_entry),

 

Step 3. Copy the ffmpeg.so module in php default module location. Now you have to edit php.ini file to enable ffmpeg-php support in it by using ffmpeg.so module.

 #nano /etc/php.ini

Put the below two lines at the end of the php.ini file

[ffmpeg]
extension=ffmpeg.so

FFmpeg-PHP extension should now be installed. You can check by creating a file called info.php in /var/www/html/ with the following content:

<?php phpinfo(); ?>

How To Fix 504 Gateway Time-out on Nginx Web Server

Fix 504 Gateway Time-out on Nginx

In this tutorial we are going to learn how to fix 504 gateway time-out on Nginx web server on Linux server. If you run a Nginx web server you may have already encountered the annoying 504 Gateway Time-out errors. This is pretty common error, are generated most probably by the PHP max execution time limit or by the FastCGI read timeout settings.

This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation to fix nginx 504 gateway timeout on the nginx webserver.

Fix 504 Gateway Time-out on Nginx

Changes in php.ini

Try raising max_execution_time setting in php.ini file (CentOS path is /etc/php.ini):

 max_execution_time = 150

Changes in PHP-FPM

Try raising request_terminate_timeout setting in php.ini file (CentOS path is /etc/php-fpm.d):

 request_terminate_timeout = 150

Changes in Nginx Config

Finally, add fastcgi_read_timeout variable inside our Nginx virtual host configuration:

location ~* \.php$ {
    include         fastcgi_params;
    fastcgi_index   index.php;
    fastcgi_read_timeout 150;
    fastcgi_pass    127.0.0.1:9000;
    fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
}

Reload PHP-FPM and Nginx

 
service php-fpm restart
service nginx restart

For Nginx as Proxy for Apache web server, this is what you have to try to fix the 504 Gateway Timeout error:

Add following variables to nginx.conf file:

proxy_connect_timeout       600;
proxy_send_timeout          600;
proxy_read_timeout          600;
send_timeout                600;

Once complete, simply reload Nginx:

 service nginx restart

Congratulation’s! You have successfully fix error nginx 504 gateway time out. Thanks for using this tutorial for fix 504 gateway timeout error in Linux system. For additional help or useful information, we recommend you to check the official Nginx web site.

How To Enable Gzip Compression on Nginx CentOS

Enable Gzip Compression on Nginx CentOS

Nginx is one of the most popular web servers in the world and is responsible for hosting some of the largest and highest-traffic sites on the internet. It is more resource-friendly than Apache in most cases and can be used as a web server or a reverse proxy. So today we’re going to learn how to setup enable Gzip compression on Nginx on CentOS 6 or 7. Compressing your scripts and images is a good idea to optimize your website’s load times.

This article assumes you have at least basic knowledge of linux, know how to use the shell, and most importantly, you host your site on your own VPS. In this post, I will talk about an easy way to enable GZIP compression on nginx servers. It’s really not that difficult. Let’s start with Nginx.

Enable Gzip Compression on Nginx

Step 1. Configure nginx.conf (/etc/nginx/nginx.conf)

gzip on;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_proxied any;
gzip_min_length  1100;
gzip_buffers 16 8k;
gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_disable "MSIE [1-6].(?!.*SV1)";
gzip_vary on;

Step 2. Now, you simply need to restart your server.

 service nginx restart

If you wish to test if GZIP is enabled, use this command:

 curl -H "Accept-Encoding: gzip" -I https://wpcademy.com

With that file now in place, restart your server and you will now be serving site assets with gzip compression. Google takes site speed into account when ranking and placing your sites in their search engine so do your users a favor and strive for the fastest site possible, especially for mobile users.

Congratulation’s! You have successfully enable Gzip on Nginx. Thanks for using this tutorial for enable gzip compression Nginx on Linux system. For additional help or useful information, we recommend you to check the official Nginx web site.