Skip to content
Menu
DevSecOps Now!!!
  • About
  • Certifications
  • Contact
  • Courses
  • DevSecOps Consulting
  • DevSecOps Tools
  • Training
  • Tutorials
DevSecOps Now!!!

Free SSL Certificate Generation Tutorial for Any Website Using Certbot and Apache

Posted on May 12, 2026

Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

This tutorial explains how to generate and configure a free SSL certificate for any website using Let’s Encrypt Certbot with the webroot method.

You can use this same process for any domain by replacing the domain name and project path.


Example Domain Used in This Tutorial

In this example, we are using:

myeventsnow.jp
www.myeventsnow.jp

Project public path:

/opt/lampp/htdocs/myeventsnow.jp/public

Step 1: Confirm Website Public Directory

First, check your website public directory.

Example:

ls -la /opt/lampp/htdocs/myeventsnow.jp/public

Make sure this folder exists and your website files are inside it.

For Laravel projects, the correct webroot is usually:

/project-folder/public

Example:

/opt/lampp/htdocs/myeventsnow.jp/public

Step 2: Generate Free SSL Certificate Using Certbot

Run the following command:

sudo certbot certonly --webroot \
-w /opt/lampp/htdocs/myeventsnow.jp/public \
-d myeventsnow.jp \
-d www.myeventsnow.jp

Explanation of the Command

Command PartMeaning
certbot certonlyGenerates certificate only, without automatically changing Apache config
--webrootUses the website folder to verify domain ownership
-wWebsite public directory path
-d myeventsnow.jpMain domain
-d www.myeventsnow.jpWWW version of domain

Step 3: SSL Certificate Location

After successful generation, Certbot will show paths like this:

Certificate is saved at: /etc/letsencrypt/live/myeventsnow.jp/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/myeventsnow.jp/privkey.pem

These two files are required in Apache SSL configuration.


Step 4: Create Apache SSL VirtualHost

Now create or update your Apache SSL configuration file.

Example SSL VirtualHost:

<VirtualHost *:443>
    ServerName myeventsnow.jp
    ServerAlias www.myeventsnow.jp

    DocumentRoot "/opt/lampp/htdocs/myeventsnow.jp/public"

    <Directory "/opt/lampp/htdocs/myeventsnow.jp/public">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    SSLEngine on
    SSLCertificateFile "/etc/letsencrypt/live/myeventsnow.jp/fullchain.pem"
    SSLCertificateKeyFile "/etc/letsencrypt/live/myeventsnow.jp/privkey.pem"

    ErrorLog "/opt/lampp/logs/myeventsnow_ssl_error.log"
    CustomLog "/opt/lampp/logs/myeventsnow_ssl_access.log" combined
</VirtualHost>

Step 5: Important Correction in Log File Names

In your current config, log files are written as:

ErrorLog "/opt/lampp/logs/amaravatiorbit_ssl_error.log"
CustomLog "/opt/lampp/logs/amaravatiorbit_ssl_access.log" combined

For better clarity, change them to the current website name:

ErrorLog "/opt/lampp/logs/myeventsnow_ssl_error.log"
CustomLog "/opt/lampp/logs/myeventsnow_ssl_access.log" combined

This is not mandatory, but it is recommended so that logs are easy to identify.


Step 6: Optional HTTP to HTTPS Redirect

You should also create a port 80 VirtualHost to redirect HTTP traffic to HTTPS.

<VirtualHost *:80>
    ServerName myeventsnow.jp
    ServerAlias www.myeventsnow.jp

    DocumentRoot "/opt/lampp/htdocs/myeventsnow.jp/public"

    <Directory "/opt/lampp/htdocs/myeventsnow.jp/public">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</VirtualHost>

This will redirect:

http://myeventsnow.jp

to:

https://myeventsnow.jp

Step 7: Test Apache Configuration

Before restarting Apache, test the configuration.

For normal Apache:

sudo apachectl configtest

For XAMPP/LAMPP Apache:

sudo /opt/lampp/bin/apachectl configtest

Expected output:

Syntax OK

Step 8: Restart Apache

For XAMPP/LAMPP:

sudo /opt/lampp/lampp restart

Or only restart Apache:

sudo /opt/lampp/lampp restartapache

For system Apache:

sudo systemctl restart apache2

Step 9: Check Website

Now open your website:

https://myeventsnow.jp

Also check:

https://www.myeventsnow.jp

The website should open with SSL successfully.


Step 10: Check Certificate Renewal

Let’s Encrypt SSL certificates are usually valid for around 90 days, so renewal should be configured.

Test renewal with:

sudo certbot renew --dry-run

If the test is successful, automatic renewal should work.

You can also manually renew certificates using:

sudo certbot renew

After renewal, restart Apache:

sudo /opt/lampp/lampp restartapache

Generic Command for Any Website

Use this format for any domain:

sudo certbot certonly --webroot \
-w /path/to/your/project/public \
-d yourdomain.com \
-d www.yourdomain.com

Example:

sudo certbot certonly --webroot \
-w /opt/lampp/htdocs/example.com/public \
-d example.com \
-d www.example.com

Generic Apache SSL VirtualHost for Any Website

<VirtualHost *:443>
    ServerName yourdomain.com
    ServerAlias www.yourdomain.com

    DocumentRoot "/path/to/your/project/public"

    <Directory "/path/to/your/project/public">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    SSLEngine on
    SSLCertificateFile "/etc/letsencrypt/live/yourdomain.com/fullchain.pem"
    SSLCertificateKeyFile "/etc/letsencrypt/live/yourdomain.com/privkey.pem"

    ErrorLog "/opt/lampp/logs/yourdomain_ssl_error.log"
    CustomLog "/opt/lampp/logs/yourdomain_ssl_access.log" combined
</VirtualHost>

Common Errors and Fixes

1. Certbot Shows 500 Error

If Certbot gives a 500 error during verification, check:

tail -f /opt/lampp/logs/error_log

Also check your Laravel log:

tail -f /opt/lampp/htdocs/myeventsnow.jp/storage/logs/laravel.log

Possible reasons:

  • Wrong DocumentRoot
  • Permission issue
  • Laravel error
  • .htaccess issue
  • Website returning 500 on /.well-known/acme-challenge/

2. Certificate Path Not Found

Check if certificate files exist:

ls -la /etc/letsencrypt/live/myeventsnow.jp/

If files are missing, Certbot generation was not successful.


3. Apache Not Starting After SSL Config

Run:

sudo /opt/lampp/bin/apachectl configtest

If any syntax error appears, fix the Apache config file and restart Apache again.


Final Notes

This method is useful when you want full control over Apache SSL configuration. The certonly --webroot method generates the SSL certificate, and then you manually add the certificate path in the Apache VirtualHost.

For any new website, you only need to change:

Domain name
Project public path
SSL certificate path
Log file names

Example values to replace:

yourdomain.com
/path/to/your/project/public
/etc/letsencrypt/live/yourdomain.com/fullchain.pem
/etc/letsencrypt/live/yourdomain.com/privkey.pem
Post Views: 21
  • Apache HTTPS setup
  • Apache SSL configuration
  • Certbot Apache SSL
  • Certbot SSL tutorial
  • Certbot webroot method
  • free SSL certificate
  • free SSL certificate for website
  • free SSL for Laravel website
  • generate free SSL certificate
  • how to install free SSL certificate
  • LAMPP Apache SSL setup
  • Let’s Encrypt Apache tutorial
  • Let’s Encrypt free SSL
  • redirect HTTP to HTTPS Apache
  • SSL certificate renewal
Subscribe
Login
Notify of
guest
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
  • Free SSL Certificate Generation Tutorial for Any Website Using Certbot and Apache
  • The Ultimate Guide to Certified FinOps Professional: Skills, Levels, and Career Impact
  • Certified FinOps Manager: Essential Skills for Modern Cloud Operations
  • How to Use Claude AI for Programming: Complete Guide for Developers to Boost Productivity
  • The Definitive Guide to Certified FinOps Engineer: Master Cloud Value Engineering
  • A Comprehensive Guide to the Certified FinOps Architect Certification and Training
  • Linux Server Diagnostic Commands: Complete Guide for Performance, Network & System Troubleshooting
  • The Ultimate Guide to CDOM – Certified DataOps Manager Certification
  • The Practical Path to AI Reliability: A Guide to the Certified MLOps Manager
  • Master the Machine Learning Lifecycle:Guide to Becoming a Certified MLOps Architect
  • How to Build a Project-Level AI Memory System That Works Across Codex, Claude, and Other AI Coding Tools
  • Certified MLOps Professional: A Deep Dive into the Certified MLOps Professional Certification
  • Certified MLOps Engineer : The Comprehensive Guide to Mastering Machine Learning Operations
  • Codex vs Claude: A Complete Practical Guide for Modern Developers (2026)
  • Certified AIOps Professional Program A Guide to Career Growth
  • Keycloak Multi-Client Architecture with Project-Based Email Validation (Student, Trainer, Company, Consulting)
  • Incorrect definition of table mysql.column_stats
  • Mautic and PHP 8.3 Compatibility Guide (2026)
  • Certified AIOps Engineer: The Complete Career Path and Certification Guide
  • How to Rename Apache Virtual Host Files Safely (Step-by-Step Guide for Linux)
  • AIOps Foundation Certification: Everything You Need to Know to Get Certified
  • DevOps to Certified Site Reliability Professional: A Senior Mentor’s Guide
  • Certified Site Reliability Manager Training, Preparation, and Career Mapping
  • Certified Site Reliability Architect: The Complete Career Guide
  • What Is a VPN? A Complete Beginner-to-Advanced Tutorial
  • How to Install, Secure, and Tune MySQL 8.4 on Ubuntu 24.04 for Apache Event MPM and PHP-FPM
  • Complete Guide to Certified Site Reliability Engineer Career
  • Certified DevSecOps Professional Step by Step
  • Certified DevSecOps Manager: Complete Career Guide
  • Certified DevSecOps Engineer: Skills, Career Path and Certification Guide

Recent Comments

  1. emmy day on SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘provider’ in ‘field list’
  2. digital banking on Complete Tutorial: Setting Up Laravel Telescope Correctly (Windows + XAMPP + Custom Domain)
  3. SAHIL DHINGRA on How to Uninstall Xampp from your machine when it is not visible in Control panel programs & Feature ?
  4. Abhishek on MySQL: List of Comprehensive List of approach to secure MySQL servers.
  5. Kristina on Best practices to followed in .httacess to avoid DDOS attack?

Archives

  • May 2026
  • April 2026
  • March 2026
  • February 2026
  • January 2026
  • December 2025
  • November 2025
  • October 2025
  • September 2025
  • August 2025
  • July 2025
  • June 2025
  • May 2025
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • July 2024
  • June 2024
  • May 2024
  • April 2024
  • March 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • September 2023
  • August 2023
  • July 2023
  • May 2023
  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • December 2022

Categories

  • Ai
  • AI Blogging
  • AiOps
  • ajax
  • Android Studio
  • Antimalware
  • Antivirus
  • Apache
  • Api
  • API Security
  • Api Testing
  • APK
  • Aws
  • Bike Rental Services
  • ChatGPT
  • Code Linting
  • Composer
  • cPanel
  • Cyber Threat Intelligence
  • Cybersecurity
  • Data Loss Prevention
  • Database
  • dataops
  • Deception Technology
  • DeepSeek
  • Devops
  • DevSecOps
  • DevTools
  • Digital Asset Management
  • Digital Certificates
  • Docker
  • Drupal
  • emulator
  • Encryption Tools
  • Endpoint Security Tools
  • Error
  • facebook
  • Firewalls
  • Flutter
  • git
  • GITHUB
  • Google Antigravity
  • Google play console
  • Google reCAPTCHA
  • Gradle
  • Guest posting
  • health and fitness
  • IDE
  • Identity and Access Management
  • Incident Response
  • Instagram
  • Intrusion Detection and Prevention Systems
  • jobs
  • Joomla
  • Keycloak
  • Laravel
  • Law News
  • Lawyer Discussion
  • Legal Advice
  • Linkedin
  • Linkedin Api
  • Linux
  • Livewire
  • Mautic
  • Medical Tourism
  • MlOps
  • MobaXterm
  • Mobile Device Management
  • Multi-Factor Authentication
  • MySql
  • Network Traffic Analysis tools
  • Paytm
  • Penetration Testing
  • php
  • PHPMyAdmin
  • Pinterest Api
  • Quora
  • SAST
  • SecOps
  • Secure File Transfer Protocol
  • Security Analytics Tools
  • Security Auditing Tools
  • Security Information and Event Management
  • Seo
  • Server Management Tools
  • Single Sign-On
  • Site Reliability Engineering
  • soft 404
  • software
  • SSL
  • SuiteCRM
  • SysOps
  • Threat Model
  • Twitter
  • Twitter Api
  • ubuntu
  • Uncategorized
  • Virtual Host
  • Virtual Private Networks
  • VPNs
  • Vulnerability Assessment Tools
  • Web Application Firewalls
  • Windows Processor
  • Wordpress
  • WSL (Windows Subsystem for Linux)
  • X.com
  • Xampp
  • Youtube
©2026 DevSecOps Now!!! | WordPress Theme: EcoCoded
wpDiscuz