This guide walks you through securing your PrestaShop store with a free SSL/TLS certificate from Let’s Encrypt on a VPS (Virtual Private Server). You’ll get the green padlock in browsers, encrypted customer data, and improved search rankings. We’ll cover installing Certbot, obtaining the certificate, configuring PrestaShop to use HTTPS, and setting up automatic renewal.
What You’ll Need
- A VPS running a Linux distribution (Ubuntu, Debian, CentOS, etc.) with root or sudo access.
- A domain name pointing to your VPS’s public IP address (A record).
- PrestaShop installed and accessible via HTTP (port 80).
- SSH client (like PuTTY on Windows or Terminal on macOS/Linux) to connect to your server.
Step-by-Step
- Connect to your VPS via SSH. Open your terminal and run:
ssh user@your-server-ip. Replace ‘user’ with your username and ‘your-server-ip’ with your server’s IP address. - Update your system packages. Run
sudo apt update && sudo apt upgrade -y(for Debian/Ubuntu) orsudo yum update -y(for CentOS/RHEL). This ensures you have the latest security patches. - Install Certbot and the Apache or Nginx plugin. The plugin depends on your web server. For Apache:
sudo apt install certbot python3-certbot-apache. For Nginx:sudo apt install certbot python3-certbot-nginx. On CentOS, usesudo yum install certbot python3-certbot-apacheorpython3-certbot-nginx. - Stop your web server temporarily (optional but recommended). Some setups may have port 80 occupied. Run
sudo systemctl stop apache2orsudo systemctl stop nginxto free the port, then start it again after the certificate is issued. - Run Certbot to obtain the certificate. Execute
sudo certbot --apacheorsudo certbot --nginx. Follow the interactive prompts: enter your email address, agree to the terms of service, and select the domain name(s) you want to secure. Certbot will automatically configure your web server to use the certificate. - Test the certificate. Visit
https://yourdomain.comin your browser. You should see a padlock icon and no security warnings. If you get a warning, check the certificate details and ensure the domain matches. - Configure PrestaShop to use HTTPS. Log into your PrestaShop admin panel. Go to Shop Parameters > General. Under the ‘Maintenance’ section, set ‘Enable SSL’ to Yes. Also set ‘Enable SSL on all pages’ to Yes to force HTTPS across the entire store.
- Update your shop URL. In the same General settings page, change the ‘Shop URL’ fields to use
https://instead ofhttp://. Also update the ‘Base URI’ if necessary. - Clear PrestaShop cache. Go to Advanced Parameters > Performance and click ‘Clear cache’. This prevents old HTTP links from lingering.
- Set up automatic renewal. Let’s Encrypt certificates last 90 days. Certbot can renew them automatically. Test the renewal process with
sudo certbot renew --dry-run. If it works, add a cron job to runcertbot renewtwice daily. For example, edit crontab withsudo crontab -eand add:0 0,12 * * * certbot renew --quiet.
Common Mistakes
- Forgetting to update PrestaShop URLs. Even if the certificate works, internal links may still use HTTP, causing mixed content warnings. Always update the shop URL and enable SSL in PrestaShop.
- Not opening port 443. Your VPS firewall must allow HTTPS traffic. Use
sudo ufw allow 443/tcp(if using UFW) or check your cloud provider’s security group settings. - Using the wrong domain. Certbot will fail if the domain doesn’t point to your server’s IP. Verify DNS records before running Certbot.
- Ignoring mixed content. After enabling SSL, some resources (images, scripts) might still load over HTTP. Use a browser console to find and fix these.
Tips
- Use a wildcard certificate if you have multiple subdomains (e.g., shop.example.com, api.example.com). Run
sudo certbot --apache -d *.example.com -d example.comwith DNS-01 challenge. - Backup your configuration before making changes. PrestaShop and web server configs are critical.
- Monitor renewal. Set up email alerts or use a monitoring service to ensure your certificate renews successfully.
- Consider HTTP to HTTPS redirect. Certbot usually adds this automatically. If not, add a 301 redirect in your server config to avoid duplicate content.
Troubleshooting
- Certbot fails with ‘Invalid response from http://…’ This usually means port 80 isn’t accessible or the domain doesn’t point to your server. Check your firewall and DNS.
- Certificate issued but browser shows warning. Ensure the certificate is for the exact domain you’re visiting (including ‘www’ if applicable). Also check that your server’s time is correct.
- PrestaShop admin panel becomes inaccessible after enabling SSL. This can happen if the certificate isn’t valid. Temporarily disable SSL by editing
config/settings.inc.phpand setting_PS_SSL_ENABLED_to ‘0’. Then fix the certificate issue. - Mixed content warnings persist. Use the ‘Better Search Replace’ plugin or manually update database URLs. Or use a PrestaShop module like ‘Force HTTPS’ to handle redirects.
- Renewal fails. Check the Certbot logs at
/var/log/letsencrypt/letsencrypt.log. Common issues include port 80 being blocked or domain verification failing.
Frequently Asked Questions
Do I need to buy an SSL certificate?
No, Let’s Encrypt provides free certificates that are trusted by all major browsers. They are valid for 90 days and auto-renew.
Will HTTPS affect my PrestaShop performance?
HTTPS adds a small overhead due to encryption, but with modern hardware and HTTP/2, the impact is minimal. You can enable caching and use a CDN to mitigate.
How do I force HTTPS on all pages?
In PrestaShop, go to Shop Parameters > General and set ‘Enable SSL on all pages’ to Yes. Also ensure your server redirects HTTP to HTTPS.
Can I use Let’s Encrypt on a shared hosting plan?
This guide is for VPS. For shared hosting, check if your provider offers Let’s Encrypt integration in the control panel (like cPanel).
What if I have multiple domains on my VPS?
Certbot can issue certificates for multiple domains in one command: sudo certbot --apache -d example.com -d www.example.com -d other.com. You’ll need to select all of them during setup.
Is it safe to run Certbot automatically?
Yes, Certbot is widely used and maintained by the Electronic Frontier Foundation. Automatic renewal is safe and recommended.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Valheim Server Not Showing in Community List Fixes
- DisplayPort vs HDMI: Which Cable Should You Use?
- Soundbar vs 2.1 Speaker System: Which Is Better?
- Slack Channels for Construction Projects: Setup Guide
- Surface Won’t Turn On: Quick Fixes1.8 h
- Survive Lava for Brainrot Tier List170 points