{"id":78613,"date":"2025-11-25T02:47:23","date_gmt":"2025-11-25T02:47:23","guid":{"rendered":"http:\/\/bangla.sitestree.com\/?p=78613"},"modified":"2025-11-25T02:47:24","modified_gmt":"2025-11-25T02:47:24","slug":"using-lets-encrypt-with-apache2-https-setup","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=78613","title":{"rendered":"Using Let\u2019s Encrypt With Apache2 (HTTPS Setup)"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<p>By ChatGPT as is:<\/p>\n\n\n\n<p>Below is a clear <strong>step-by-step guide to using Let\u2019s Encrypt (free SSL) with Apache2<\/strong>.<br>This assumes you already have a domain pointing to your server\u2019s public IP.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\u2705 <strong>Using Let\u2019s Encrypt With Apache2 (HTTPS Setup)<\/strong><\/h1>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Method: Certbot (recommended)<\/strong><\/h3>\n\n\n\n<p>Let\u2019s Encrypt issues FREE SSL certificates, automated and trusted by browsers.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>1. Install Certbot + Apache plugin<\/strong><\/h1>\n\n\n\n<p>On Ubuntu\/Debian:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update\nsudo apt install certbot python3-certbot-apache\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>2. Verify Apache VirtualHost for HTTP<\/strong><\/h1>\n\n\n\n<p>You need a working HTTP site first:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/apache2\/sites-available\/yourdomain.conf\n<\/code><\/pre>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;VirtualHost *:80&gt;\n    ServerName yourdomain.com\n    ServerAlias www.yourdomain.com\n    DocumentRoot \/var\/www\/yourdomain\n&lt;\/VirtualHost&gt;\n<\/code><\/pre>\n\n\n\n<p>Enable it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo a2ensite yourdomain.conf\nsudo systemctl reload apache2\n<\/code><\/pre>\n\n\n\n<p>Test by visiting:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>http:&#47;&#47;yourdomain.com\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>3. Allow ports (80 and 443)<\/strong><\/h1>\n\n\n\n<p>Let\u2019s Encrypt requires port <strong>80<\/strong> open.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ufw allow 80\nsudo ufw allow 443\nsudo ufw reload\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>4. Obtain the SSL certificate<\/strong><\/h1>\n\n\n\n<p>Now run Certbot:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo certbot --apache -d yourdomain.com -d www.yourdomain.com\n<\/code><\/pre>\n\n\n\n<p>Certbot will ask:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Choose the domain(s)<\/strong><\/li>\n\n\n\n<li><strong>Redirect HTTP \u2192 HTTPS automatically (recommended)<\/strong><\/li>\n<\/ol>\n\n\n\n<p>Certbot will:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Create the certificate<\/li>\n\n\n\n<li>Install it into Apache<\/li>\n\n\n\n<li>Modify your VirtualHost<\/li>\n\n\n\n<li>Reload Apache<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>5. Validate certificate installation<\/strong><\/h1>\n\n\n\n<p>Visit:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>https:&#47;&#47;yourdomain.com\n<\/code><\/pre>\n\n\n\n<p>Check padlock icon in browser.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>6. Certificate auto-renew (built in)<\/strong><\/h1>\n\n\n\n<p>Certbot automatically installs a cron job.<\/p>\n\n\n\n<p>Test it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo certbot renew --dry-run\n<\/code><\/pre>\n\n\n\n<p>If no errors \u2192 your SSL will auto-renew forever.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>7. Where certificates are stored<\/strong><\/h1>\n\n\n\n<p>Let\u2019s Encrypt puts certs here:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/etc\/letsencrypt\/live\/yourdomain.com\/\n<\/code><\/pre>\n\n\n\n<p>You\u2019ll see:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>cert.pem (public certificate)<\/li>\n\n\n\n<li>privkey.pem (private key)<\/li>\n\n\n\n<li>chain.pem (CA chain)<\/li>\n\n\n\n<li>fullchain.pem (cert + chain)<\/li>\n<\/ul>\n\n\n\n<p>Apache config uses:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SSLCertificateFile \/etc\/letsencrypt\/live\/yourdomain.com\/fullchain.pem\nSSLCertificateKeyFile \/etc\/letsencrypt\/live\/yourdomain.com\/privkey.pem\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>8. Optional: Force HTTPS manually (if you didn\u2019t let certbot do it)<\/strong><\/h1>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/apache2\/sites-available\/yourdomain.conf\n<\/code><\/pre>\n\n\n\n<p>Add redirect in port 80 VirtualHost:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;VirtualHost *:80&gt;\n    ServerName yourdomain.com\n    Redirect permanent \/ https:\/\/yourdomain.com\/\n&lt;\/VirtualHost&gt;\n<\/code><\/pre>\n\n\n\n<p>Reload Apache:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl reload apache2\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\u2714\ufe0f Summary<\/h1>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Step<\/th><th>Action<\/th><\/tr><\/thead><tbody><tr><td>1<\/td><td>Install certbot + apache plugin<\/td><\/tr><tr><td>2<\/td><td>Ensure HTTP VirtualHost works<\/td><\/tr><tr><td>3<\/td><td>Open required ports<\/td><\/tr><tr><td>4<\/td><td>Run certbot to obtain SSL<\/td><\/tr><tr><td>5<\/td><td>Test HTTPS<\/td><\/tr><tr><td>6<\/td><td>Verify auto-renew<\/td><\/tr><tr><td>7<\/td><td>Check certificate file paths<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>By ChatGPT as is: Below is a clear step-by-step guide to using Let\u2019s Encrypt (free SSL) with Apache2.This assumes you already have a domain pointing to your server\u2019s public IP. \u2705 Using Let\u2019s Encrypt With Apache2 (HTTPS Setup) Method: Certbot (recommended) Let\u2019s Encrypt issues FREE SSL certificates, automated and trusted by browsers. 1. Install Certbot &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=78613\">Continue reading<\/a><\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1978],"tags":[],"class_list":["post-78613","post","type-post","status-publish","format-standard","hentry","category-computer-networks","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":78611,"url":"http:\/\/bangla.sitestree.com\/?p=78611","url_meta":{"origin":78613,"position":0},"title":"Buy SSL from Hosting Provider","author":"Author-Check- Article-or-Video","date":"November 25, 2025","format":false,"excerpt":"Using SSL from Your Hosting Provider Instead If your hosting provider offers SSL, the process becomes simpler because: CSR generation Key storage Certificate installation Renewal \u2026are often automated within cPanel, Plesk, or a custom dashboard. However, the overall workflow remains the same: Obtain SSL Generate CSR Verify domain Install certificate\u2026","rel":"","context":"In &quot;Computer Networks&quot;","block_context":{"text":"Computer Networks","link":"http:\/\/bangla.sitestree.com\/?cat=1978"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":21831,"url":"http:\/\/bangla.sitestree.com\/?p=21831","url_meta":{"origin":78613,"position":1},"title":"Some Ubuntu Linux Commands used in AWS platform #Unix\/Linux #RHCSA","author":"Author-Check- Article-or-Video","date":"March 7, 2021","format":false,"excerpt":"Some Ubuntu Linux Commands used in AWS platform Some might be run by the parent commands This is kinda cleaned up from .bash_history (removed repeating and sensitive commands), still not perfectly cleaned up - so you will see lots of ls, cd, dir or similar \u00a0 sudo apt-get update sudo\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":78609,"url":"http:\/\/bangla.sitestree.com\/?p=78609","url_meta":{"origin":78613,"position":2},"title":"How to Convert an HTTP Website to HTTPS Using a Third-Party SSL Certificate (Apache 2 Guide)","author":"Author-Check- Article-or-Video","date":"November 25, 2025","format":false,"excerpt":"How to Convert an HTTP Website to HTTPS Using a Third-Party SSL Certificate (Apache 2 Guide) Securing your website with HTTPS is essential for trust, SEO, and protecting user data. Many hosting providers sell SSL certificates, but you may prefer purchasing SSL from a third-party Certificate Authority (CA). This guide\u2026","rel":"","context":"In &quot;Computer Networks&quot;","block_context":{"text":"Computer Networks","link":"http:\/\/bangla.sitestree.com\/?cat=1978"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":25055,"url":"http:\/\/bangla.sitestree.com\/?p=25055","url_meta":{"origin":78613,"position":3},"title":"Learn and practice some CentOS Linux : Redhat Linux #Root","author":"Author-Check- Article-or-Video","date":"April 15, 2021","format":false,"excerpt":"This is mostly about Centos Linux. However, this also shows commands related to how to install Magento 2 on LEMP (E for Nginx Web-server). Some PHP related stuff are there as well. Let's Encrypt included. LEMP + CentOS + Magento 2 : VM Image or one click install: I did\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":14846,"url":"http:\/\/bangla.sitestree.com\/?p=14846","url_meta":{"origin":78613,"position":4},"title":"Learn some CentOS Linux : Redhat Linux","author":"Sayed","date":"June 29, 2019","format":false,"excerpt":"This is mostly about Centos Linux. However, this also shows commands related to how to install Magento 2 on LEMP (E for Nginx Web-server). Some PHP related stuff are there as well. LEMP + CentOS + Magento 2 : VM Image or one click install: I did not see readily\u2026","rel":"","context":"In &quot;Magento 2&quot;","block_context":{"text":"Magento 2","link":"http:\/\/bangla.sitestree.com\/?cat=1907"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":22047,"url":"http:\/\/bangla.sitestree.com\/?p=22047","url_meta":{"origin":78613,"position":5},"title":"How to Secure Your .Net Applications #Software Development #Web Development #Root #By Sayed Ahmed","author":"Author-Check- Article-or-Video","date":"March 9, 2021","format":false,"excerpt":"How to Secure Your .Net Application Use multiple levels of security: Physical Level (data center security), Network Level (firewall), Operating System Level (accounts, trust level), Web Server Level (use virtual directory), Web Application Level (authentication, authorization), Database Level (different accounts to perform different types of database operations), Data Level (encrypt\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/78613","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=78613"}],"version-history":[{"count":1,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/78613\/revisions"}],"predecessor-version":[{"id":78614,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/78613\/revisions\/78614"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=78613"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=78613"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=78613"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}