CS-Cart is a commercial PHP shopping cart that can be used for any online business, from a small startup to a large web shop. It uses a MySQL database to store data and a template engine to build the website’s look. You can easily build an ecommerce website of any size from a small web store to a virtual shopping mall using CS-Cart.
CS-Cart is commercial software, so you will get a 30 days trial and after the trial period is over, the free mode will be activated automatically. But you can use only limited features.
CS-Cart provides a very user friendly web admin panel with useful e-commerce features such as promotion and marketing tools alon with integration with major shipping and payment services.
In this tutorial, we will learn how to install and setup CS-Cart shopping cart on Ubuntu 16.04 server.
Requirements
- A server runing Ubuntu-16.04 on your system.
- A non-root user with sudo privileges setup on your server.
Update the System
Before starting, you will need to update the system’s package repository database with the latest version. You can do this with the following command:
sudo apt-get update -y
sudo apt-get upgrade -y
Installing LEMP Server
Before starting, you will need to have a LEMP server installed on your system. If not, you can install it with the following command:
sudo apt-get install nginx mariadb-server php7.0 php7.0-fpm php7.0-mysql php7.0-cli php7.0-gd php7.0-mbstring php-pear php7.0-curl
Once installation is completed, start the Nginx service and enable it to start at boot with the following command:
sudo systemctl start nginx
sudo systemctl enable nginx
Configure MariaDB for CS-Cart
By default, MariaDB installation is not secure, so you will need to secure it first by running mysql_secure_installation
script.
You can do this with the following command:
sudo mysql_secure_installation
During the interactive process, answer all the questions as shown below:
Enter current password for root (enter for none): Enter
Set root password? [Y/n]: Y
New password: <your-password>
Re-enter new password: <your-password>
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
Once MariaDB is secured, you can login to MySQL shell with the following command:
mysql -u root -p
Enter your root password.
Next, create a database named cscartdb
with the username cscart
and password cscart
:
MariaDB [(none)]> Create database cscartdb;
MariaDB [(none)]>CREATE USER 'cscart'@'localhost' IDENTIFIED BY 'cscart';
Next, grant all privileges with the following command:
MariaDB [(none)]> GRANT ALL PRIVILEGES ON
cscartdb.* TO 'cscart'@'localhost';
Next, flush all privileges:
MariaDB [(none)]> FLUSH PRIVILEGES;
Then, exit from the MySQL shell:
MariaDB [(none)]>quit;
Download CS-Cart
You can download the latest version of CS-Cart available from here to the server. CS-Cart is commercial software, so you will get only 30 days trial.
Then, extract it by running the following command:
sudo mkdir /var/www/html/cscart
sudo unzip cscart_v4.4.1.zip -d /var/www/html/cscart
Next, you will need to set proper permission to web root directory:
sudo chown -R www-data:www-data /var/www/html/cscart
sudo chmod -R 755 /var/www/html/cscart
Configuring Nginx
Once the database is configured, you can proceed to configure Nginx.
First, you will need to make some changes in nginx.conf
file located at /etc/nginx directory.
sudo nano /etc/nginx/nginx.conf
Replace all the contents with the following:
user www-data;
worker_processes 8;
error_log /var/log/nginx/error.log warn;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main ‘$remote_addr – $remote_user [$time_local] “$request” ‘
‘$status $body_bytes_sent “$http_referer” ‘
‘”$http_user_agent” “$http_x_forwarded_for”‘;
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
server_tokens off;
gzip on;
gzip_vary on;
gzip_disable “msie6?;
gzip_http_version 1.0;
gzip_comp_level 8;
gzip_proxied any;
gzip_types text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
client_body_temp_path /tmp/client_temp;
# proxy_temp_path /tmp/proxy_temp;
# proxy_cache_path /var/cache/nginx/proxy_cache levels=2 keys_zone=nginx:100m inactive=200m max_size=5000m;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
fastcgi_cache_path /var/cache/nginx levels=1:2 keys_zone=cache:10m max_size=1000m inactive=60m;
fastcgi_cache_key “$scheme$request_method$host$request_uri”;
}
Next, create a virtual host file with named cscart.conf
for Nginx.
sudo nano /etc/nginx/sites-available/cscart.conf
Add the following contents:
server {
listen 80;
server_name cs-cart.com;
location / {
root /var/www/html/cscart;
index index.php;
try_files $uri $uri/ /index.php?sef_rewrite=1&$args;
}
error_page 500 502 503 504 ;
location = /index.html {
root /usr/share/nginx/html;
}
location ~ .php$ {
root /var/www/html/cscart;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/html/cscart$fastcgi_script_name;
include fastcgi_params;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_cache_valid 200 302 10m;
fastcgi_cache_valid 301 1h;
fastcgi_cache_valid any 1m;
}
location ~* .(css|js|jpg|jpeg|png|swf|gif|svg|ttf|eot)$ {
root /var/www/html/cscart;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/html/cscart$fastcgi_script_name;
include fastcgi_params;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_cache_valid 200 302 10m;
fastcgi_cache_valid 301 1h;
fastcgi_cache_valid any 1m;
}
location ~* .(css|js|jpg|jpeg|png|swf|gif|svg|ttf|eot)$ {
root /var/www/html/cscart;
try_files $uri http://backend$1;
expires max;
log_not_found off;
add_header Cache-Control “public”;
}
location ~ /.ht {
deny all;
}
}
Next, enable this virtual host by creating a symlink to it from the /etc/nginx/sites-enabled/ directory:
sudo ln -s /etc/nginx/sites-available/cs-cart.conf /etc/nginx/sites-enabled/
You can check the Nginx configuration for syntex error with the following command:
sudo nginx -t
Once syntex is ok, then restart the Nginx service:
sudo systemctl restart nginx
Configure Firewall
Before accessing the CS_Cart, you will need to allow HTTP service through UFW firewall. By default UFW is disabled on your system, so you need to enable it first.
You can enable it with the following command:
sudo ufw enable
Once UFW firewall is enabled, you can allow HTTP service by running the following command:
sudo ufw allow http
You can now check the status of UFW firewall by running the following command:
sudo ufw status
Accessing the CS-Cart Web Installation Wizard
Once everything is setup properly, it’s time to access CS-Cart web installation wizard. You can do this through your web browser.
Open your favourite web browser and type the URL http://cs-cart.com or httt://your-ip-address, you should see the following installation screen:
HP_NO_IMG/data/uploads/users/7ecb43a5-b365-4ebf-93d5-f3b632f29f33/87084152.png” alt=”” />
Next, click on Install
button, you should see the following License agreement screen:
HP_NO_IMG/data/uploads/users/7ecb43a5-b365-4ebf-93d5-f3b632f29f33/1383104266.png” alt=”” />
Next, accept the license agreement and click on Next button, You should see the following Server Configuration screen, Enter all the required information and click on Install
button:
HP_NO_IMG/data/uploads/users/7ecb43a5-b365-4ebf-93d5-f3b632f29f33/245847735.png” alt=”” />
Once the installation successfully finished, you should see the following screen:
HP_NO_IMG/data/uploads/users/7ecb43a5-b365-4ebf-93d5-f3b632f29f33/1565900822.png” alt=”” />
Next, click on the Adminitrator Panel
you should see the following CS-Cart dashboard:
HP_NO_IMG/data/uploads/users/7ecb43a5-b365-4ebf-93d5-f3b632f29f33/1691767722.png” alt=”” />
That’s it…
Conclusion
Congratulations! you have successfully installed CS-Cart using Nginx web server on Ubuntu 16.04. You can now easily deploy your own online shop using CS-Cart.