{"id":1495,"date":"2026-08-12T21:40:55","date_gmt":"2026-08-12T21:40:55","guid":{"rendered":"https:\/\/matthewvallejos.com\/?p=1495"},"modified":"2026-08-13T09:06:00","modified_gmt":"2026-08-13T09:06:00","slug":"deploying-a-custom-domain-on-aws-lightsail-with-cloudflare-dns-and-ssl","status":"publish","type":"post","link":"https:\/\/matthewvallejos.com\/?p=1495","title":{"rendered":"Deploying a Custom Domain on AWS Lightsail with Cloudflare DNS and SSL"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">Objectives:<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Deploy a personal portfolio site on AWS to build hands-on cloud infrastructure experience<\/li>\n\n\n\n<li>Configure a custom domain, DNS, and HTTPS from scratch rather than relying on a fully managed host<\/li>\n\n\n\n<li>Understand the full chain connecting a domain name to a working, secure website<\/li>\n<\/ul>\n\n\n\n<h1 class=\"wp-block-heading\">Process:<\/h1>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Purchased matthewvallejos.com and set up an AWS Lightsail instance running WordPress on Debian Linux<\/li>\n\n\n\n<li>Attached a static IP to the instance to prevent it from changing on reboot<\/li>\n\n\n\n<li>Configured Cloudflare as the domain&#8217;s DNS provider, pointing nameservers away from the registrar&#8217;s default<\/li>\n\n\n\n<li>Created an A record on the root domain pointing to the Lightsail static IP, and a CNAME record aliasing www to the root domain<\/li>\n\n\n\n<li>Enabled Cloudflare&#8217;s proxy (orange cloud) on both records for DDoS protection and to hide the origin server&#8217;s IP<\/li>\n\n\n\n<li>Set up Cloudflare Email Routing to forward a custom-domain email address to an existing inbox, and added SPF\/DMARC records to protect the domain from spoofing<\/li>\n\n\n\n<li>Generated a Cloudflare Origin CA certificate (ECDSA) and installed it on the server with SFTP and SSH to support Full Strict encryption between Cloudflare and the origin<\/li>\n\n\n\n<li>Enabled &#8220;Always Use HTTPS&#8221; to force encrypted connections client-side and server-side<\/li>\n<\/ul>\n\n\n\n<h1 class=\"wp-block-heading\">Debugging:<\/h1>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Initially attempted to use AWS Certificate Manager instead of Cloudflare&#8217;s certificate, but discovered ACM certificates aren&#8217;t installable directly on a standalone Lightsail instance without an Application Load Balancer \u2014 reverted to Cloudflare&#8217;s Origin CA certificate, which is directly installable and free<\/li>\n\n\n\n<li>After installing the certificate, WordPress&#8217;s own site URL settings still pointed to HTTP in the database, which had to be corrected directly to avoid conflicting with Cloudflare&#8217;s proxy<\/li>\n\n\n\n<li>The site loaded securely on desktop but defaulted to HTTP on mobile, traced to a missing &#8220;Always Use HTTPS&#8221; redirect rule rather than a certificate problem, since encryption and forced redirection are handled separately<\/li>\n<\/ul>\n\n\n\n<h1 class=\"wp-block-heading\">Outcome:<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Fully deployed, secured personal domain running on AWS Lightsail, with Cloudflare-managed DNS, email routing, and end-to-end HTTPS enforced at both the server and browser level. Gained hands-on experience with DNS record types, certificate authorities and the TLS handshake, and diagnosing infrastructure issues layer by layer rather than guessing at fixes.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Fully deployed, secured personal domain running on AWS Lightsail, with Cloudflare-managed DNS, email routing, and end-to-end HTTPS enforced at both the server and browser level. Gained hands-on experience with DNS record types, certificate authorities and the TLS handshake, and diagnosing infrastructure issues layer by layer rather than guessing at fixes.<\/p>\n","protected":false},"author":1,"featured_media":1498,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,12],"tags":[],"class_list":["post-1495","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cloud","category-websites"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":7}},"_links":{"self":[{"href":"https:\/\/matthewvallejos.com\/index.php?rest_route=\/wp\/v2\/posts\/1495","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/matthewvallejos.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/matthewvallejos.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/matthewvallejos.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/matthewvallejos.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1495"}],"version-history":[{"count":2,"href":"https:\/\/matthewvallejos.com\/index.php?rest_route=\/wp\/v2\/posts\/1495\/revisions"}],"predecessor-version":[{"id":1551,"href":"https:\/\/matthewvallejos.com\/index.php?rest_route=\/wp\/v2\/posts\/1495\/revisions\/1551"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/matthewvallejos.com\/index.php?rest_route=\/wp\/v2\/media\/1498"}],"wp:attachment":[{"href":"https:\/\/matthewvallejos.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1495"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/matthewvallejos.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1495"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/matthewvallejos.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1495"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}