Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Install WellCommerce on an Ubuntu VPS

In this article, we will explain how to install WellCommerce on an Ubuntu 14.04 VPS with MariaDB, PHP-FPM and Nginx. WellCommerce is an open-source e-commerce platform written in PHP on top of the Symfony 3.1 framework. WellCommerce is only supported on PHP 7.x. and it will not work with previous PHP versions. This guide should work on other Linux virtual servers as well but it was tested and written for an Ubuntu 14.04 virtual server.

Login to your VPS via SSH

ssh user@vps_IP

Update the system and install necessary packages

[user]$ sudo apt-get update && sudo apt-get -y upgrade
[user]$ sudo apt-get install software-properties-common git nano curl build-essential

Install MariaDB 10.1

To add the MariaDB repository to your sources list and install the latest MariaDB server, run the following commands:

[user]$ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
[user]$ sudo add-apt-repository 'deb http://ftp.osuosl.org/pub/mariadb/repo/10.1/ubuntu trusty main'
[user]$ sudo apt-get update
[user]$ sudo apt-get install -y mariadb-server

When the installation is complete, run the following command to secure your installation:

[user]$ mysql_secure_installation

Next, we need to create a database for the WellCommerce installation.

[user]$ mysql -uroot -p
MariaDB [(none)]> CREATE DATABASE wc;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON wc.* TO 'wc'@'localhost' IDENTIFIED BY 'strongpassword';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> \q

Install and configure PHP, composer and required PHP modules

To install the latest stable version of PHP version 7 and all necessary modules, run:

[user]$ sudo add-apt-repository ppa:ondrej/php
[user]$ sudo apt-get update
[user]$ sudo apt-get -y install php7.0-fpm php7.0-cli php7.0-gd php7.0-mysql php7.0-intl php7.0-mbstring php-pear php7.0-curl php7.0-dev

APCu is the official replacement for the outdated APC extension. To install it, run the following commands:

[user]$ sudo pecl install apcu
sudo sh -c "echo extension=apcu.so > /etc/php/7.0/mods-available/apcu.ini"
sudo ln -s /etc/php/7.0/mods-available/apcu.ini /etc/php/7.0/fpm/conf.d/20-apcu.ini
sudo ln -s /etc/php/7.0/mods-available/apcu.ini /etc/php/7.0/cli/conf.d/20-apcu.ini
sudo service php7.0-fpm restart

Composer is a dependency manager for PHP with which you can install packages. Composer will pull in all the required libraries and dependencies you need for your project.

[user]$ curl -sS https://getcomposer.org/installer | php
[user]$ sudo mv composer.phar /usr/local/bin/composer

Create a new PHP-FPM pool for your user:

[user]$ sudo nano /etc/php/7.0/fpm/pool.d/your_user.conf
[your_user]
user = your_user
group = your_user
listen = /var/run/php-fpm-your_user.sock
listen.owner = your_user
listen.group = your_user
listen.mode = 0666
pm = ondemand
pm.max_children = 5
pm.process_idle_timeout = 10s
pm.max_requests = 200
chdir = /

Do not forget to change your_user with your username.

Restart PHP-FPM:

[user]$ sudo service php7.0-fpm restart

Install WellCommerce

Create a root directory for your WellCommerce shop using the following command:

[user]$ mkdir -p ~/myWellCommerce.org/public_html

Run the composer create-project command to create a new WellCommerce installation:

[user]$ composer create-project wellcommerce/wellcommerce ~/myWellCommerce.org/public_html

During the installation process you will be asked to enter the configuration parameters.

To create a database, install assets and import sample data, run the following:

[user]$ cd ~/myWellCommerce.org/public_html
[user]$ php app/console wellcommerce:install

Install and configure Nginx

Ubuntu 14.04 comes with Nginx version 1.4, to install the latest stable version of Nginx version 1.8, run:

[user]$ sudo add-apt-repository -y ppa:nginx/stable
[user]$ sudo apt-get update
[user]$ sudo apt-get -y install nginx

Next, create a new Nginx server block:

[user]$ sudo nano /etc/nginx/sites-available/myWellCommerce.org
server {

    listen      80;
    server_name myWellCommerce.org;
    root /home/your_user/myWellCommerce.org/public_html/web;

    access_log  /var/log/nginx/wellcommerce.access.log;
    error_log   /var/log/nginx/wellcommerce.error.log;

    location / { 
        try_files $uri /app.php$is_args$args;
    }

    location ~* \.(css|js|gif|jpe?g|png)$ {
        expires 1M;
        add_header Pragma public;
        add_header Cache-Control "public, must-revalidate, proxy-revalidate";
    }

    location ~ ^/(app|app_dev|config)\.php(/|$) {
        fastcgi_pass unix:/var/run/php-fpm-your_user.sock;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;
        fastcgi_param  SCRIPT_FILENAME  $realpath_root$fastcgi_script_name;
        fastcgi_param DOCUMENT_ROOT $realpath_root;
    }

    location ~ /\.ht {
        deny all;
    }
}

Do not forget to change your_user with your username.

Activate the server block by creating a symbolic link :

[user]$ sudo ln -s /etc/nginx/sites-available/myWellCommerce.org /etc/nginx/sites-enabled/myWellCommerce.org

Test the Nginx configuration and restart nginx:

[user]$ sudo nginx -t
[user]$ sudo service nginx restart

Open https://myWellCommerce.org/ in your favorite web browser and you should see the WellCommerce home screen. The default username and password are both admin.

That’s it. You have successfully installed WellCommerce on your Ubuntu 14.04 VPS. For more information about how to manage your WellCommerce installation, please refer to the official WellCommerce site.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.



This post first appeared on Virtual-Server.org Virtual Server, please read the originial post: here

Share the post

Install WellCommerce on an Ubuntu VPS

×

Subscribe to Virtual-server.org Virtual Server

Get updates delivered right to your inbox!

Thank you for your subscription

×