Secure Your Site: Install Let's Encrypt SSL with LAMP Stack on Rocky Linux 8

This tutorial guides you through the process of securing your website with Let's Encrypt SSL/TLS certificate on a LAMP (Linux, Apache, MySQL, PHP) stack running on Rocky Linux 8. Let's Encrypt provides free SSL certificates, ensuring secure HTTPS connections for your site.

rocky linux Let's Encrypt SSL LAMP
Large
VPS
3
vCPU
12 GB
Memory
120 GB
NVMe Disk
6144 GB
Traffic
29.90 €
/month
* Up to 6 vCPU, 36GB RAM, 360GB NVMe Disk Space and 1Gbit/s Network Speed
#### Prerequisites Before you begin, ensure you have: - A server running Rocky Linux 8 with LAMP stack installed - A registered domain name pointing to your server's IP address - SSH access to your server with sudo privileges - Basic familiarity with the command line on Linux #### Step 1: Install Certbot Certbot is a tool for obtaining and managing Let's Encrypt SSL certificates. Install Certbot and Apache plugin on Rocky Linux 8: ```bash sudo dnf install certbot python3-certbot-apache ``` #### Step 2: Configure Apache Virtual Hosts Ensure your Apache virtual host configuration is set up correctly to serve your website over HTTPS. Edit your virtual host configuration file (`/etc/httpd/conf.d/your_domain.conf`): ```apache ServerName your_domain.com ServerAlias www.your_domain.com DocumentRoot /var/www/html/your_site_directory ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined ``` #### Step 3: Obtain SSL Certificate Run Certbot to obtain a new SSL certificate for your domain: ```bash sudo certbot --apache -d your_domain.com -d www.your_domain.com ``` Follow the prompts to configure SSL certificate options. #### Step 4: Verify SSL Configuration Certbot will automatically configure Apache to use the SSL certificate. Test your SSL configuration: ```bash sudo apachectl configtest ``` #### Step 5: Automatically Renew SSL Certificate Let's Encrypt certificates expire every 90 days. Set up a cron job to automatically renew them: ```bash sudo crontab -e ``` Add the following line to renew certificates twice a day: ```bash 0 */12 * * * certbot renew --quiet ``` #### Step 6: Test HTTPS Access Access your website using `https://your_domain.com` in a web browser. Verify that your site is now served over HTTPS with a valid SSL certificate. #### Conclusion You have successfully secured your LAMP-based website on Rocky Linux 8 with Let's Encrypt SSL/TLS certificate. Your visitors can now access your site securely over HTTPS. **Additional Resources:** - **Certbot Documentation:** [https://certbot.eff.org/docs/](https://certbot.eff.org/docs/) - **Rocky Linux Documentation:** [https://docs.rockylinux.org/](https://docs.rockylinux.org/)

Related Tutorials



    Created with ❤ at Estonia
    EcoStack Technology OÜ