Install PrestaShop with Apache and Let’s Encrypt SSL on Debian 11
PrestaShop is a freemium, open-source e-commerce instrument. It means that you can get started your individual on-line retailer with safe bills, a couple of delivery strategies, customized issues, and extra – regardless of your stage of technical technology or earlier e-commerce enjoy.
Small and medium-sized companies incessantly use it, however its options make it superb for enormous e-commerce dealers as neatly.
While PrestaShop is obtainable on all website hosting environments or cloud, you’ll be able to additionally set up it to your Debian Linux gadget free of charge to broaden your retailer.
Here, we will be able to see how you can set up PrestaShop with Apache and Let’s Encrypt SSL on Debian 11.
Prerequisites
Install LAMP Stack
First, observe the underneath hyperlink to put in the LAMP stack for PrestaShop set up.
Install AMP (Apache, MariaDB, and PHP) on Debian 11
Install PHP Extensions
After putting in the LAMP stack, use the apt
command to put in the underneath PHP extensions for PrestaShop.
sudo apt replace sudo apt set up -y php-zip php-xml php-gd php-curl php-intl php-xmlrpc php-mbstring php-imagick php-mysql
Configure PHP Settings for PrestaShop
PrestaShop recommends a couple of PHP configurations for the shop. So, upload the underneath PHP values in /and so on/php/7.4/apache2/php.ini
report. You would possibly building up or lower values as according to your necessities.
memory_limit = 256M
upload_max_filesize = 64M
post_max_size = 64M
sudo sed -i 's/memory_limit = .*/memory_limit = 256M/' /and so on/php/7.4/apache2/php.ini sudo sed -i 's/post_max_size = .*/post_max_size = 64M/' /and so on/php/7.4/apache2/php.ini sudo sed -i 's/upload_max_filesize = .*/upload_max_filesize = 64M/' /and so on/php/7.4/apache2/php.ini
Setup Apache Virtual Host for PrestaShop
We will get started with making a digital host for the PrestaShop set up. Typically the digital host report accommodates a ServerName, ServerAlias, Port quantity, Document root, log location, and so on.
For this put up, I’m assuming the next:
Domain identify: www.holhol24.web
Port No: 80
Document root: /var/www/html/www.holhol24.web/
First, create a digital host report.
sudo nano /and so on/apache2/sites-available/www.holhol24.web.conf
Then, upload the next content material into the above configuration report. Change the values as according to your requirement.
ServerName holhol24.web ServerAlias www.holhol24.web ServerAdmin admin@holhol24.web DocumentRoot /var/www/html/www.holhol24.web ErrorLog ${APACHE_LOG_DIR}/www.holhol24.net_error.log CustomLog ${APACHE_LOG_DIR}/www.holhol24.net_access.log blended /var/www/html/www.holhol24.web> Options FollowSymlinks AllowOverride All Require all granted
Create a listing to retailer your PrestaShop information.
sudo mkdir -p /var/www/html/www.holhol24.web/
Next, allow the PrestaShop website and Apache modules (SSL and rewrite).
sudo a2ensite www.holhol24.web sudo a2enmod rewrite ssl
Finally, restart the Apache carrier.
sudo systemctl restart apache2
Install Let’s Encrypt SSL Certificate
Create DNS Record
Go for your area registrar and create a DNS document [A and CNAME (optional if you do not want to use www subdomain)] document in your PrestaShop area.
- Non-www Domain Name (Ex. holhol24.web) >> A document level for your server IP
- www Domain Name (Ex. www.holhol24.web) >> CNAME document level to holhol24.web
For this demo, I created two information in order that my PrestaShop online page will probably be obtainable at www.holhol24.web.
Install Certbot shopper
After developing DNS information, set up the Certbot shopper to generate and set up the SSL certificates. The Certbot shopper is now obtainable as a snap bundle for Debian working gadget. So, first, it is important to set up snapd to your gadget.
sudo apt replace sudo apt set up -y snapd
After the set up, replace snapd to the newest model.
sudo snap set up core && sudo snap refresh core
Finally, set up the Certbot the usage of the snap command.
sudo snap set up --classic certbot sudo ln -s /snap/bin/certbot /usr/bin/certbot
Install SSL Certificate
Use the certbot
command to generate and set up the Let’s Encrypt SSL certificates at the Apache webserver.
sudo certbot --apache
1. Enter e-mail deal with to obtain notification on pressing renewal and safety notices
2. Type Y and press Enter to sign in with the ACME server
3. Type Y or N to obtain emails about EFF information, campaigns, publication.
4. Certbot will routinely stumble on the online page(s) you created and ask you to turn on HTTPS for it. Type 1 or suitable numbers separated by way of a comma when you have a couple of internet sites.
Which names do you want to turn on HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: holhol24.web
2. www.holhol24.web
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the correct numbers separated by way of commas and/or areas, or depart enter
clean to make a choice all choices proven (Enter 'c' to cancel): 1,2
Wait for the SSL set up to finish.
Redirect non-www HTTP requests to www HTTPS with Apache
The Certbot shopper will position redirect regulations to redirect the site visitors from HTTP to the HTTPS online page like underneath.
1. http://holhol24.web >> https://holhol24.web
2. http://www.holhol24.web >> https://www.holhol24.web
As you’ll be able to see, the primary area isn’t attaining the www HTTPS online page. So, to mend the redirection, you’ll have to upload yet one more to redirect site visitors from non-www HTTP to www HTTPS area, I.e., http://holhol24.web >> https://www.holhol24.web.
Auto-Renew SSL Certificate
The Certbot shopper features a systemd carrier and it looks after computerized certificates renewals. So, you’ll now not must renew the certificate manually.
Install PrestaShop with Apache
Create Database for PrestaShop Installation
First, login into MariaDB/MySQL database server.
sudo mysql -u root -p
Then, create a database for PrestaShop set up with the person and password.
CREATE DATABASE prestadb; CREATE USER 'prestauser'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON prestadb.* TO 'prestauser'@'localhost'; EXIT
Download PrestaShop Package
Download the newest model of the PrestaShop bundle by way of working the next command within the terminal.
mkdir /tmp/playstation && cd /tmp/playstation wget https://obtain.prestashop.com/obtain/releases/prestashop_1.7.8.0.zip
Then, extract the downloaded report.
unzip prestashop_1.7.8.0.zip unzip prestashop.zip
And then, transfer the information to the online page root listing.
sudo mv * /var/www/html/www.holhol24.web/
Update the possession and a bunch of the PrestaShop online page listing.
sudo chown -R www-data:www-data /var/www/html/www.holhol24.web/
Install PrestaShop
Open your browser and discuss with your online page to accomplish the PrestaShop set up.
https://your-prestashop-website
1. Select Language for the PrestaShop installer (Only for the installer help, now not for the shop) after which click on Next
2. Accept License Agreements after which click on Next
3. Enter Shop identify, Main job, Install Demo information (if required), Country, Enable SSL (if required) within the details about the shop. Then, input account knowledge for developing an administrator account in Your Account phase after which click on Next
4. Enter the Database main points after which click on Next
5. The set up will take a couple of minutes relying on whether or not you have got selected to put in demo information or now not.
5. You can get admission to PrestaShop’s Back Office and Front Office by way of clicking on Manage your retailer and Discover your retailer respectively. Note down the admin URL whilst you discuss with it for the primary time, because the admin URL would possibly trade for every set up like http://www.holhol24.web/admin145wvvep1 or http://www.holhol24.web/admin145w3sep1.
You will want to take away the underneath folders for safety causes.
sudo rm -rf /var/www/html/www.holhol24.web/{set up,medical doctors,README.md}
Access PrestaShop Store
Now, it is possible for you to to get admission to the PrestaShop along with your area identify.
https://your-prestashop-website
Screenshot of PrestaShop Front Office with Demo Content:
Screenshot of PrestaShop Back Office:
Conclusion
That’s All. I am hoping you have got discovered how you can set up PrestaShop with Apache and Let’s Encrypt SSL on Debian 11.