AbanteCart is a robust and feature-rich e-commerce application that allows you to create multiple online stores with support for various payment gateways, currencies, languages, and more. In this comprehensive tutorial, we will guide you through the process of installing AbanteCart on a Debian 11 based server, using Nginx as the web server and SSL for secure communication.
Prerequisites
Before diving into the installation process, make sure you have the following prerequisites:
- A server running Debian 11.
- A non-root user with sudo privileges.
- All packages on your system are updated.
To update your system, run the following commands:
sudo apt update sudo apt upgrade
You will also need to install a few packages that are necessary for the installation process. Use the following command to install them:
sudo apt install wget curl nano ufw software-properties-common dirmngr apt-transport-https gnupg2 ca-certificates lsb-release unzip debian-archive-keyring -y
Step 1 – Configure Firewall
The first step is to configure the firewall on your Debian server. Debian comes with Uncomplicated Firewall (ufw) pre-installed. To check if the firewall is running, use the following command:
sudo ufw status
If the firewall is inactive, you can proceed with configuring it. Start by allowing the SSH port to avoid any disruptions in the current connection when enabling the firewall:
sudo ufw allow OpenSSH
Next, allow HTTP and HTTPS ports for web traffic:
sudo ufw allow 80/tcp sudo ufw allow 443/tcp
Finally, enable the firewall:
sudo ufw enable
To verify the status of the firewall, run the following command:
sudo ufw status
You should see a similar output:
Status: active To Action From -- ------ ---- OpenSSH ALLOW Anywhere 80/tcp ALLOW Anywhere 443/tcp ALLOW Anywhere OpenSSH(v6) ALLOW Anywhere(v6) 80/tcp(v6) ALLOW Anywhere(v6) 443/tcp(v6) ALLOW Anywhere(v6)
Step 2 – Install PHP
AbanteCart requires PHP 8.0 and several extensions to function properly. We will install PHP 8.0 using Ondrej’s PHP repository. To add the repository, run the following command:
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/sury-php.list
Next, import the GPG key associated with the repository:
wget -qO https://packages.sury.org/php/apt.gpg | sudo apt-key add-
Update the Debian repositories:
sudo apt update
Now, you can install PHP 8.0 and the required extensions:
sudo apt install php8.0-cli php8.0-fpm php8.0-mysql php8.0-gd php8.0-common php8.0-curl php8.0-xml php8.0-mbstring
Step 3 – Install MySQL
AbanteCart relies on MySQL as the database server. To install MySQL, follow these steps:
First, add the GPG key for the MySQL package:
sudo gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3A79BD29
Next, add the official MySQL repository:
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/mysql8.0-archive-keyring.gpg] http://repo.mysql.com/apt/debian/ `lsb_release -cs` mysql-8.0" | sudo tee /etc/apt/sources.list.d/mysql-8.list
Update the Debian repositories:
sudo apt update
Install the MySQL server:
sudo apt install mysql-server
During the installation process, you will be prompted to set a root password for MySQL. Choose a strong password and remember it for future use.
After the installation is complete, you can secure the MySQL installation by running the following command:
sudo mysql_secure_installation
This command will guide you through a series of prompts to enhance the security of your MySQL installation. Follow the instructions and choose appropriate options based on your requirements.
Step 4 – Install Nginx
Debian ships with an older version of Nginx. To install the latest version of Nginx, you need to add the official Nginx repository. Here’s how you can do it:
Import the official Nginx signing key:
curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor | sudo tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null
Add the repository for Nginx’s stable version:
echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg arch=amd64] http://nginx.org/packages/debian `lsb_release -cs` nginx" | sudo tee /etc/apt/sources.list.d/nginx.list
Update the Debian repositories:
sudo apt update
Install Nginx:
sudo apt install nginx
To verify the installation, run the following command:
sudo nginx -v
You should see the version of Nginx installed on your system.
Next, enable the Nginx service so that it starts automatically on system boot:
sudo systemctl enable nginx
Step 5 – Configure MySQL for AbanteCart
Now that we have installed MySQL, we need to configure it to work with AbanteCart. Here’s how you can do it:
Secure the MySQL installation by running the following command:
sudo mysql_secure_installation
During this process, you will be prompted to enter the root password you set earlier. Follow the on-screen instructions to configure various security options for your MySQL installation.
Once the MySQL installation is secured, you can proceed to create a user and database for AbanteCart.
First, log in to the MySQL shell:
mysql -u root -p
Enter your root password when prompted.
Next, create a user for AbanteCart and grant it privileges on the newly created database:
CREATE USER 'abcart'@'localhost' IDENTIFIED BY 'Your_password2'; CREATE DATABASE abantecart; GRANT ALL PRIVILEGES ON abantecart.* TO 'abcart'@'localhost';
Replace 'Your_password2'
with a strong password of your choice.
Exit the MySQL shell:
exit
Step 6 – Install AbanteCart
With the necessary prerequisites and configurations in place, it’s time to install AbanteCart. Follow these steps:
Download the latest version of AbanteCart from the official Github repository:
wget https://github.com/abantecart/abantecart-src/archive/master.zip
Extract the downloaded file:
unzip master.zip
Create the public webroot directory for AbanteCart:
sudo mkdir /var/www/html/abantecart -p
Copy the extracted abantecart-src-master/public_html
directory to the webroot directory:
sudo cp -r abantecart-src-master/public_html /var/www/html/abantecart
Set the proper permissions for the webroot directory:
sudo chown -R nginx:nginx /var/www/html/abantecart
At this point, the basic installation of AbanteCart is complete. Before finishing the installation, we need to set up SSL and Nginx.
Step 7 – Install SSL
To provide secure communication between the server and clients, we will install an SSL certificate using Let’s Encrypt. Follow these steps:
Install the Certbot tool, which is used to obtain and manage SSL certificates:
sudo apt install snapd sudo snap install core && sudo snap refresh core sudo snap install --classic certbot sudo ln -s /snap/bin/certbot /usr/bin/certbot
Verify the Certbot installation:
certbot --version
You should see the version information for Certbot.
Generate the SSL certificate for your domain:
sudo certbot certonly --standalone --agree-tos --no-eff-email --staple-ocsp --preferred-challenges http -m test@example.com -d abantecart.example.com
Replace abantecart.example.com
with your actual domain name.
The above command will download the SSL certificate and store it in the /etc/letsencrypt/live/abantecart.example.com
directory on your server.
Next, generate a Diffie-Hellman group certificate:
sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048
Create a directory for Let’s Encrypt auto-renewal:
sudo mkdir -p /var/lib/letsencrypt
Create a cron job to automatically renew the SSL certificate. Open the crontab file:
sudo nano /etc/cron.daily/certbot-renew
Paste the following code into the file:
#!/bin/sh certbot renew --cert-name abantecart.example.com --webroot -w /var/lib/letsencrypt/ --post-hook "systemctl reload nginx"
Save the file and exit the text editor.
Make the cron job file executable:
sudo chmod +x /etc/cron.daily/certbot-renew
Step 8 – Configure Nginx and PHP
To ensure that Nginx and PHP work seamlessly with AbanteCart, we need to make a few configuration changes. Follow these steps:
Open the PHP-FPM configuration file:
sudo nano /etc/php/8.0/fpm/pool.d/www.conf
Find the lines user=www-data
and group=www-data
and change them to user=nginx
and group=nginx
respectively:
... user = nginx group = nginx ...
Next, find the lines listen.owner=www-data
and listen.group=www-data
and change them to listen.owner=nginx
and listen.group=nginx
respectively:
... listen.owner = nginx listen.group = nginx ...
Save the file and exit the text editor.
Disable the PHP opcache extension by opening the opcache configuration file:
sudo nano /etc/php/8.0/fpm/conf.d/10-opcache.ini
Add the following line at the end of the file:
opcache.enable=0
Save the file and exit the text editor.
Restart the PHP-FPM service to apply the changes:
sudo systemctl restart php8.0-fpm
Next, create and open the Nginx configuration file for AbanteCart:
sudo nano /etc/nginx/conf.d/abantecart.conf
Paste the following code into the file:
server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name abantecart.example.com; access_log /var/log/nginx/abantecart.access.log; error_log /var/log/nginx/abantecart.error.log; # SSL ssl_certificate /etc/letsencrypt/live/abantecart.example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/abantecart.example.com/privkey.pem; ssl_trusted_certificate /etc/letsencrypt/live/abantecart.example.com/chain.pem; ssl_session_timeout 5m; ssl_session_cache shared:MozSSL:10m; ssl_session_tickets off; ssl_protocols TLSv1.2 TLSv1.3; ssl_prefer_server_ciphers on; ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384; ssl_ecdh_curve X25519:prime256v1:secp384r1:secp521r1; ssl_stapling on; ssl_stapling_verify on; ssl_dhparam /etc/ssl/certs/dhparam.pem; resolver 8.8.8.8; root /var/www/html/abantecart; index index.php; location / { try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_pass unix:/run/php/php8.0-fpm.sock; # Depends on the PHP Version fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; include fastcgi_params; try_files $uri =404; } location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } location ~* \.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$|\.php_ { deny all; } location ~ /\. { deny all; access_log off; log_not_found off; } ### Retina images handler. Check cookie and look for file with @2x at the end of the name location ~* ^(.*)\.(jpg|jpeg|png|gif|webp)$ { set $hidpi_uri $1@2x.$2; if ($http_cookie !~ 'HTTP_IS_RETINA=1') { break; } try_files $hidpi_uri $uri =404; } location ~* \.(jpg|jpeg|png|gif|css|js|ico|webp)$ { expires max; log_not_found off; } location ~ /(system/logs|resources/download) { deny all; return 403; } location /admin/ { location ~ .*\.php?$ { deny all; return 403; } } # Enforce HTTPS server { listen 80; listen [::]:80; server_name abantecart.example.com; return 301 https://$host$request_uri; } }
Make sure to replace abantecart.example.com
with your actual domain name.
Save the file and exit the text editor.
Open the main Nginx configuration file:
sudo nano /etc/nginx/nginx.conf
Add the following line before the line include /etc/nginx/conf.d/*.conf;
:
server_names_hash_bucket_size 64;
Save the file and exit the text editor.
To verify the syntax of the Nginx configuration file, run the following command:
sudo nginx -t
If there are no syntax errors, you should see the following output:
nginx: configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
Start the Nginx service to apply the new configuration:
sudo systemctl start nginx
Step 9 – Finish Installation
Now that all the configurations are in place, you can proceed with the final steps to finish the installation of AbanteCart. Follow these steps:
Launch your web browser and visit https://abantecart.example.com
(replace with your actual domain name). You will be presented with the AbanteCart installation page.
Read and agree to the license agreement by checking the box, and then click on “Continue” to proceed.
The installer will check if all the requirements are met. If everything is in order, click on “Continue” to proceed to the next page.
On the next page, you will be asked to provide the database credentials. Enter the database username, password, and database name that you created earlier. You can also create an administrator account and a security key for accessing the control panel. If you want to import demo data, keep the checkbox checked; otherwise, uncheck it to start with a clean installation. Click on “Continue” when you have entered all the required information.
The installer will then proceed to set up the database and configure AbanteCart. Once the process is complete, you will be presented with a success message.
Bookmark the link to your AbanteCart control panel, as you will need it to manage your online store.
For security reasons, it is recommended to remove the installer files from your server. Run the following command to delete the installer files:
sudo rm -rf /var/www/html/abantecart/install
Congratulations! You have successfully installed AbanteCart on your Debian 11 server with Nginx and SSL.
Conclusion
In this tutorial, we walked you through the step-by-step process of installing AbanteCart on a Debian 11 server using Nginx as the web server and SSL for secure communication. By following this guide, you can set up a powerful and feature-rich e-commerce platform. AbanteCart offers a wide range of capabilities, allowing you to create and manage multiple online stores with ease.
If you have any questions or run into any issues during the installation process, feel free to leave a comment below. We’re here to help you succeed in creating a successful online store.
This tutorial was brought to you by Shape.host, a leading provider of Linux SSD VPS and cloud hosting services. With Shape.host, you can enjoy reliable, scalable, and secure cloud hosting solutions tailored to your business needs.