{"id":79093,"date":"2026-11-17T02:00:22","date_gmt":"2026-11-17T02:00:22","guid":{"rendered":"http:\/\/bangla.sitestree.com\/?p=79093"},"modified":"2026-11-17T02:00:22","modified_gmt":"2026-11-17T02:00:22","slug":"linux-advanced-08-https","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=79093","title":{"rendered":"Linux Advanced 08 \u2014 Apache Virtual Hosts and HTTPS"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/bangla.sitestree.com\/?name=linux-course-index\">Linux course index<\/a> \u00b7 <a href=\"https:\/\/bangla.sitestree.com\/?cat=1992\">Linux Advanced category<\/a> \u00b7 Lesson 8 of 9<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>AI disclosure<\/strong> \u2014 AI-generated content, posted as is. AI can make mistakes. This lesson draws on the linked Open Education posts and adds original explanations or lab examples where useful. The newly written explanations and examples may be freely reused. Linked source material retains its own terms.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Learning goal<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Test Apache name-based routing locally and verify HTTPS with certificate and renewal checks.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Concepts and setup<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A virtual host maps the requested host and port to settings and a DocumentRoot. A client sends an HTTP Host header. For HTTPS, TLS starts before HTTP and SNI usually helps the server choose a certificate. The site&#8217;s Certbot procedure assumes an authorized public domain. You cannot get a public certificate for a private .test hostname. Use a disposable Ubuntu or Debian VM with Apache installed for the first lab.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Create one name-based vhost and test it from the same VM<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo install -d -m 0755 \/var\/www\/oe-linux-test\nprintf 'Open Education Apache lab\\n' | sudo tee \/var\/www\/oe-linux-test\/index.html\nsudo tee \/etc\/apache2\/sites-available\/oe-linux-test.conf &gt;\/dev\/null &lt;&lt;'EOF'\n&lt;VirtualHost *:80&gt;\n    ServerName web.example.test\n    DocumentRoot \/var\/www\/oe-linux-test\n&lt;\/VirtualHost&gt;\nEOF\nsudo a2ensite oe-linux-test\nsudo apachectl configtest &amp;&amp; sudo systemctl reload apache2\ncurl -fsS --resolve web.example.test:80:127.0.0.1 http:\/\/web.example.test\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Possible output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Open Education Apache lab\nEnabling site oe-linux-test.\nSyntax OK\nOpen Education Apache lab<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Use unused file names. &#8211;resolve targets loopback while keeping the requested hostname. After testing, run a2dissite oe-linux-test, test and reload the config, and remove only these fixture files.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">On a separate domain you manage, verify trust and renewal<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Replace www.example.com with your authorized domain.\ncurl -IsS https:\/\/www.example.com\/\n# On that server, after legitimate Certbot setup:\nsudo certbot certificates\nsudo certbot renew --dry-run<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Possible output<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>HTTP\/2 200\n...\nCertificate Name: www.example.com\n...\nCongratulations, all simulated renewals succeeded: ...<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">These commands verify an existing deployment. To obtain a certificate, use the CA\u2019s supported validation procedure. HTTP-01 uses incoming port 80. DNS-01 uses a DNS TXT challenge and can suit a service that is not public over HTTP. Do not use curl -k as evidence of trust.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Questions only<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Quick-check questions<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n\n<li>Why can a browser reject a certificate from a known CA?<\/li>\n\n\n<li>Does apachectl configtest prove that the client sees the right website?<\/li>\n\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Assessment questions<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n\n<li>The default vhost answers instead of the new site. What do you verify?<\/li>\n\n\n<li>What evidence should a certificate-renewal checklist include?<\/li>\n\n\n<li>When would you consider DNS-01 instead of HTTP-01?<\/li>\n\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Questions and answers<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Quick-check answers<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n\n<li><strong>Why can a browser reject a certificate from a known CA?<\/strong><br><strong>Answer<\/strong> \u2014 The requested name may not match, the certificate may be expired, or the chain may be unsuitable.<\/li>\n\n\n<li><strong>Does apachectl configtest prove that the client sees the right website?<\/strong><br><strong>Answer<\/strong> \u2014 No. It validates configuration syntax, not application routing.<\/li>\n\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Assessment answer key<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n\n<li><strong>The default vhost answers instead of the new site. What do you verify?<\/strong><br><strong>Answer<\/strong> \u2014 Inspect apachectl -S, the enabled vhost, listener port, ServerName, and the name the client actually sends.<\/li>\n\n\n<li><strong>What evidence should a certificate-renewal checklist include?<\/strong><br><strong>Answer<\/strong> \u2014 Verify hostname and chain from a client, check expiry, perform an authorized renewal dry run, and confirm automatic scheduling.<\/li>\n\n\n<li><strong>When would you consider DNS-01 instead of HTTP-01?<\/strong><br><strong>Answer<\/strong> \u2014 When you control DNS validation and do not want to make the web server publicly reachable on port 80, or need a wildcard certificate.<\/li>\n\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Source articles on this site<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n\n<li><a href=\"https:\/\/bangla.sitestree.com\/?p=78613\">Using Let\u2019s Encrypt With Apache2 (HTTPS Setup)<\/a><\/li>\n\n\n<li><a href=\"https:\/\/bangla.sitestree.com\/?p=16422\">How To Set Up Apache Virtual Hosts on Ubuntu 16.04<\/a><\/li>\n\n\n<li><a href=\"https:\/\/bangla.sitestree.com\/?p=21831\">Some Ubuntu Linux Commands used in AWS platform #Unix\/Linux #RHCSA<\/a><\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Technical references<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n\n<li><a href=\"https:\/\/ubuntu.com\/server\/docs\/\">Ubuntu Server guide to networking and certificates<\/a><\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Continue the course<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Previous lesson 07 \u2014 Time Synchronization with chrony. Next lesson 09 \u2014 MariaDB Service Accounts and Restore Verification.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/bangla.sitestree.com\/?name=linux-course-index\">Linux course index<\/a> \u00b7 <a href=\"https:\/\/bangla.sitestree.com\/?cat=1992\">Linux Advanced category<\/a> \u00b7 Lesson 8 of 9<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Test Apache name-based routing locally and verify HTTPS with certificate and renewal checks.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[1992],"tags":[],"class_list":["post-79093","post","type-post","status-publish","format-standard","hentry","category-linux-advanced","item-wrap"],"jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":79102,"url":"http:\/\/bangla.sitestree.com\/?p=79102","url_meta":{"origin":79093,"position":0},"title":"Linux Administration Course \u2014 Start Here and Lesson Index","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"A 33-lesson Linux course from shell fundamentals to server administration, performance, and a recovery capstone.","rel":"","context":"In &quot;Linux Basics&quot;","block_context":{"text":"Linux Basics","link":"http:\/\/bangla.sitestree.com\/?cat=1990"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":79094,"url":"http:\/\/bangla.sitestree.com\/?p=79094","url_meta":{"origin":79093,"position":1},"title":"Linux Advanced 09 \u2014 MariaDB Service Accounts and Restore Verification","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"Check a Linux-hosted MariaDB service, identify least-privilege database roles, and test a logical restore.","rel":"","context":"In &quot;Linux Advanced&quot;","block_context":{"text":"Linux Advanced","link":"http:\/\/bangla.sitestree.com\/?cat=1992"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":79092,"url":"http:\/\/bangla.sitestree.com\/?p=79092","url_meta":{"origin":79093,"position":2},"title":"Linux Advanced 07 \u2014 Time Synchronization with chrony","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"Distinguish clock display from synchronization and show whether chrony selected a source.","rel":"","context":"In &quot;Linux Advanced&quot;","block_context":{"text":"Linux Advanced","link":"http:\/\/bangla.sitestree.com\/?cat=1992"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":79088,"url":"http:\/\/bangla.sitestree.com\/?p=79088","url_meta":{"origin":79093,"position":3},"title":"Linux Advanced 03 \u2014 SELinux Contexts, Booleans, and Denials","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"Diagnose ordinary permission and SELinux policy problems separately and set a persistent file context.","rel":"","context":"In &quot;Linux Advanced&quot;","block_context":{"text":"Linux Advanced","link":"http:\/\/bangla.sitestree.com\/?cat=1992"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":79096,"url":"http:\/\/bangla.sitestree.com\/?p=79096","url_meta":{"origin":79093,"position":4},"title":"Linux Advanced 2 02 \u2014 Rootless Containers with Podman","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"Serve a fixture with rootless Podman and verify that its port is published only on loopback.","rel":"","context":"In &quot;Linux Advanced 2&quot;","block_context":{"text":"Linux Advanced 2","link":"http:\/\/bangla.sitestree.com\/?cat=1993"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":79101,"url":"http:\/\/bangla.sitestree.com\/?p=79101","url_meta":{"origin":79093,"position":5},"title":"Linux Advanced 2 07 \u2014 Capstone: Build, Diagnose, and Recover a Linux Service","author":"Sayed","date":"November 17, 2026","format":false,"excerpt":"Demonstrate Linux service deployment, evidence-led incident diagnosis, and recovery in one lab.","rel":"","context":"In &quot;Linux Advanced 2&quot;","block_context":{"text":"Linux Advanced 2","link":"http:\/\/bangla.sitestree.com\/?cat=1993"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/79093","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\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=79093"}],"version-history":[{"count":0,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/79093\/revisions"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=79093"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=79093"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=79093"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}