Install LiteCart on Ubuntu 14.04 with Nginx, PHP-FPM and MySQL

litecartIn this tutorial we will explain how to install LiteCart on an Ubuntu 14.04 VPS with Nginx, PHP-FPM and MySQL.
LiteCart is a free e-commerce, feature rich e-commerce solution.

The framework is constructed to be lightweight and easy for developers to modify and build upon.

LiteCart relies on the latest HyperText standard HTML 5, the latest CSS 3 for styling, the jQuery framework for client-side dynamics, and the popular web scripting language PHP for server-side dynamics.

REQUIREMENTS

We will be using our SSD 1 Linux VPS Hosting plan for this tutorial.

UPDATE THE SYSTEM

Make sure your server is fully up to date using:

# apt-get update && apt-get upgrade

Your next step is to install Nginx, PHP-FPM, MySQL and some needed dependencies. Run the following command:

# apt-get install nginx php5-fpm mysql-server php5-mysql php5-curl

Then, create the database needed for LiteCart. Log into your MySQL service as root:

# mysql -u root -p

mysql> create database lite;
Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on lite.* to liteuser@localhost identified by 'your_password';
Query OK, 0 rows affected (0.05 sec)

mysql> flush privileges;

mysql> exit
Bye

INSTALL LITECART

Next, install LiteCart. For our purposes we will download LiteCart into the /opt directory. Run the following commands:

# cd /opt

# wget http://download2us.softpedia.com/dl/9a4e457ced9819c2aa03f2adb2b4e551/556d7e98/700082813/webscripts/php/litecart-1.3.zip

Unzip the archive:

# unzip litecart-1.3.zip

Create the needed directory into which you will move all the installation files. Enter the following commands:

# mkdir /var/www/litecart

# mv * /var/www/litecart
Enter the newly created directory and delete the zip file we don't need:
# cd /var/www/litecart

# rm litecart-1.3.zip

CONFIGURE NGINX FOR LITECART

Your next step is to configure an Nginx block so you can access LiteCart using a domain. Therefore, create a new file using the below command:

# vim /etc/nginx/sites-available/your_domain

Paste the following into the file:

server {
listen 80 ;

root /var/www/litecart/public_html;
index index.php index.html index.htm;
rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;

server_name your_domain ;

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

location / {
# try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php?q=$uri&$args;
}

error_page 404 /404.html;

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;

}
}

Don’t forget to replace the your_domain values with your actual domain.

Enable the site:

# a2ensite your_domain

Restart Nginx for the changes to take effect:

Need a fast and easy fix?
✔ Unlimited Managed Support
✔ Supports Your Software
✔ 2 CPU Cores
✔ 2 GB RAM
✔ 50 GB PCIe4 NVMe Disk
✔ 1854 GeekBench Score
✔ Unmetered Data Transfer
NVME 2 VPS

Now just $43 .99
/mo

GET YOUR VPS
# /etc/init.d/nginx restart

Check the path of the current working directory using the command:

# pwd

You should be in the /var/www/litecart directory. If so, enter the following command to set the proper file ownership:

chown www-data -R public_html/

To finish the LiteCart installation, open your favorite web browser and navigate to http://your_domain . You will be welcomed by the installer. Check if your server meets the System Requirements. If some extensions or settings need to be enabled, you should install/enable them before proceeding. After that is done, fill in the database credentials in the MySQL field under the Installation Parameters section. Then choose your username and password for the LiteCart administration backend. After everything is done, click on Install Now.

After the installation is completed, you should delete the install directory in /var/www/litecart/

That’s it. You have successfully installed LiteCart on your Ubuntu 14.04 VPS. For more information about LiteCart, please refer to their wiki.

Of course you don’t have to do any of this if you use one of our Managed Ubuntu VPS hosting plans, in which case you can simply ask our expert Linux admins to install LiteCart for you. They are available 24×7 and will take care of your request immediately.

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.

Leave a Comment