{"id":102,"date":"2025-01-31T23:17:31","date_gmt":"2025-01-31T23:17:31","guid":{"rendered":"https:\/\/neutronxinnovation.com\/blog\/?p=102"},"modified":"2025-02-02T19:57:34","modified_gmt":"2025-02-02T19:57:34","slug":"get-a-domain-and-route-traffic-to-static-ip-address-home-server-using-cloudflare","status":"publish","type":"post","link":"https:\/\/neutronxinnovation.com\/blog\/2025\/01\/31\/get-a-domain-and-route-traffic-to-static-ip-address-home-server-using-cloudflare\/","title":{"rendered":"Get a domain and route traffic to static IP address home server using Cloudflare"},"content":{"rendered":"<p>This article is in continuation to <a href=\"https:\/\/neutronxinnovation.com\/blog\/2025\/01\/24\/install-ubuntu-and-expose-raspberry-pi-to-internet\/\" target=\"_blank\" rel=\"nofollow noopener\">Install Ubuntu and expose Raspberry Pi to internet &#8211; NeutronX Innovation Blog<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Since our server (Raspberry Pi) is up now, we can go ahead to the next steps:<\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li>Get a domain name\n<ul>\n<li>Add your domain to Cloudflare (Why I wonder? you will get your answer)<\/li>\n<li>Route traffic for your domain to your device in your home server (Raspberry Pi in my case)<\/li>\n<\/ul>\n<\/li>\n<li>Add subdomain for Authentication related web pages\/endpoints<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>Prerequisites:<\/p>\n<ul>\n<li>Must have static IP for your home internet connection.<\/li>\n<li>Money &#8211; to purchase your domain<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>Let&#8217;s get started&#8230;<\/p>\n<p>&nbsp;<\/p>\n<h3>1. Get a domain name<\/h3>\n<p>&nbsp;<\/p>\n<p>This is a fairly easy process. There are thousands of domain providers available. Cloudflare itself provides that service. However my personal favorite is <a href=\"https:\/\/hostinger.in?REFERRALCODE=HE1SHARMAIXC\" target=\"_blank\" rel=\"nofollow noopener sponsored ugc\">Hostinger.com<\/a> [If you redirect via this link and purchase a domain, I will get some commission. However it is upto you \ud83d\ude42 ], I just use that to get my domains as I find it most economical, totally clutter free UI experience and speedy support.<\/p>\n<p>&nbsp;<\/p>\n<p>After you get your domain, the next thing you want to do is create a Cloudflare account (If you&#8217;re not using Cloudflare itself for domain name). You must be wondering why Cloudflare? Well, in short, at this point of time, 20.5% of global web traffic is handled by Cloudflare. They&#8217;re pretty good at their job and provide all basic services totally free of cost (Ex: caching, DDoS prevention, CDNs etc.). Therefore it is a no-brainer for me personally.<\/p>\n<p>&nbsp;<\/p>\n<p>I will mention here the process I followed to add my domain purchased from Hostinger to Cloudflare. If you purchased it from Cloudflare itself, you can skip the Step 1 below and move to Step 2.<\/p>\n<p>&nbsp;<\/p>\n<h3>Step 1: Add your domain to Cloudflare<\/h3>\n<p>Every domain provider will have a page where you configure nameservers for the domain.<\/p>\n<p>In short, from Wikipedia definition, &#8220;Nameservers are servers in the DNS which link your domain name to some IP address where your files\/website are hosted.<\/p>\n<p>Every domain provider will by default have their name servers. Also, they will have a page in admin menu where you can change those nameservers. For example, the screen for Hostinger looks like the image below. Here you can see there is an option to change nameservers. Keep this screen handy as are going to utilize it.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-119 aligncenter\" src=\"https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/nameservers-hostinger.png\" alt=\"nameservers configuration screen for Hostinger\" width=\"998\" height=\"517\"><\/p>\n<p>&nbsp;<\/p>\n<p>Now login to Cloudflare console, click &#8220;Add a domain&#8221; and enter your domain in next screen:<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-120 aligncenter\" src=\"https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-1.png\" alt=\"cloudflare add a domain screen\" width=\"608\" height=\"271\"><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-121 aligncenter\" src=\"https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-2.png\" alt=\"cloudflare enter new domain name screen\" width=\"601\" height=\"410\"><\/p>\n<p>&nbsp;<\/p>\n<p>After that, select a plan. I don&#8217;t require anything else so I have selected free plan.<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-122 aligncenter\" src=\"https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-3.jpeg\" alt=\"cloudflare domain plan selection\" width=\"704\" height=\"686\" srcset=\"https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-3.jpeg 1339w, https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-3-300x292.jpeg 300w, https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-3-1024x998.jpeg 1024w, https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-3-768x748.jpeg 768w\" sizes=\"(max-width: 704px) 100vw, 704px\"><\/p>\n<p>&nbsp;<\/p>\n<p>Now this screen is most important. Here Cloudflare will show what will be your 2 new nameservers to be changed at your domain provider&#8217;s end:<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-123 aligncenter\" src=\"https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-4.jpeg\" alt=\"cloudflare nameserver configuration instructions\" width=\"728\" height=\"800\"><\/p>\n<p>&nbsp;<\/p>\n<p>Copy these and paste it in your domain provider nameserver configuration screen. Remove any other nameservers if already present.<\/p>\n<p>&nbsp;<\/p>\n<p>After this step, you just have to wait for some time. May be a day. After that, you will have your domain configured via Cloudflare.<\/p>\n<p>&nbsp;<\/p>\n<h3>Step 2: Point your domain name to your home&#8217;s static IP<\/h3>\n<p>&nbsp;<\/p>\n<p>Now, you need to tell Cloudflare to router all traffic for your domain to your home&#8217;s IP address. For this, go to Cloudflare &#8220;Record&#8221; settings for your domain under DNS section:<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-127 aligncenter\" src=\"https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-5.jpeg\" alt=\"cloudflare go to records under dns\" width=\"664\" height=\"436\" srcset=\"https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-5.jpeg 1246w, https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-5-300x197.jpeg 300w, https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-5-1024x671.jpeg 1024w, https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-5-768x504.jpeg 768w\" sizes=\"(max-width: 664px) 100vw, 664px\"><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>You will get a screen showing a lot of things. Don&#8217;t get overwhelmed. We need not care about them for now. Just click on &#8220;Add record&#8221; button:<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-125 aligncenter\" src=\"https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-6.jpeg\" alt=\"cloudflare records screen\" width=\"945\" height=\"503\" srcset=\"https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-6.jpeg 2463w, https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-6-300x160.jpeg 300w, https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-6-1024x545.jpeg 1024w, https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-6-768x409.jpeg 768w, https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-6-1536x818.jpeg 1536w, https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-6-2048x1090.jpeg 2048w\" sizes=\"(max-width: 945px) 100vw, 945px\"><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Now this is the main step. Here, enter the following:<\/p>\n<ul>\n<li>Type of record: <strong>A<\/strong><\/li>\n<li>Name: Your domain name (Without any prefixes like http etc..). Ex: abc.com<\/li>\n<li>IPv4 Address: Your router&#8217;s static IP<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>Click on Save and you&#8217;re done.<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-126 aligncenter\" src=\"https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-7.jpeg\" alt=\"cloudflare A record for your domain to static ip address mapping\" width=\"964\" height=\"550\" srcset=\"https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-7.jpeg 2038w, https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-7-300x171.jpeg 300w, https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-7-1024x583.jpeg 1024w, https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-7-768x438.jpeg 768w, https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-7-1536x875.jpeg 1536w\" sizes=\"(max-width: 964px) 100vw, 964px\"><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>That&#8217;s all.. All done.. Not that difficult ryt?<\/p>\n<p>&nbsp;<\/p>\n<h3>Step 3: Change encryption mode to Full under SSL\/TLS section<\/h3>\n<p>&nbsp;<\/p>\n<p>For me, it didn&#8217;t work until I did this. I am currently not aware why we need to do this, but all I know it doesn&#8217;t work without this.<\/p>\n<p>Go to SSL\/TLS section and change the encryption mode to &#8220;Full&#8221; using configure button.<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-128 aligncenter\" src=\"https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-8.jpeg\" alt=\"Cloudflare SSL\/TLS encryption mode \" width=\"1256\" height=\"654\" srcset=\"https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-8.jpeg 2386w, https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-8-300x156.jpeg 300w, https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-8-1024x533.jpeg 1024w, https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-8-768x400.jpeg 768w, https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-8-1536x800.jpeg 1536w, https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-8-2048x1066.jpeg 2048w\" sizes=\"(max-width: 1256px) 100vw, 1256px\"><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>And with this, we&#8217;re all done!<\/p>\n<p>&nbsp;<\/p>\n<p>Now we will see how can we add a subdomain for Authentication related APIs\/webpages<\/p>\n<p>&nbsp;<\/p>\n<h3>2. Add subdomain for Authentication related web pages\/endpoints<\/h3>\n<p>&nbsp;<\/p>\n<p>What we want is, to server all of our authentication related stuff on some subdomain ex: auth.abc.com. This will keep our web structure segregated. To do this, we will use similar Cloudflare configuration we did earlier with a slight change:<\/p>\n<p>&nbsp;<\/p>\n<p>Click &#8220;Add a record&#8221;:<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-125 aligncenter\" src=\"https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-6.jpeg\" alt=\"cloudflare records screen\" width=\"1129\" height=\"661\"><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Now, enter following configuration:<\/p>\n<ul>\n<li>Type of record: <strong>A<\/strong><\/li>\n<li>Name: Your sub-domain name (Without any prefixes or postfixes). Ex: auth<\/li>\n<li>IPv4 Address: Your router&#8217;s static IP<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-145 aligncenter\" src=\"https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-9.jpeg\" alt=\"Cloudflare DNS records - Add A record for subdomain\" width=\"1236\" height=\"581\" srcset=\"https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-9.jpeg 1333w, https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-9-300x141.jpeg 300w, https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-9-1024x481.jpeg 1024w, https:\/\/neutronxinnovation.com\/blog\/wp-content\/uploads\/2025\/01\/cloudflare-9-768x361.jpeg 768w\" sizes=\"(max-width: 1236px) 100vw, 1236px\"><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Click save and this is also done.<\/p>\n<p>&nbsp;<\/p>\n<p>This marks the end of our domain and Cloudflare configuration steps.<\/p>\n<p>&nbsp;<\/p>\n<p>Next step is to install nginx and configure it for our main domain and subdomain: <a href=\"https:\/\/neutronxinnovation.com\/blog\/2025\/02\/02\/install-nginx-on-ubuntu-route-traffic-for-different-subdomains-on-same-ip-address\/\" target=\"_blank\" rel=\"noopener nofollow next\">Install nginx &amp; route traffic for different subdomains<\/a><\/p>\n<p>&nbsp;<\/p>\n<hr>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article is in continuation to Install Ubuntu and expose [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_seopress_robots_primary_cat":"none","_seopress_titles_title":"Get a domain and route traffic to static IP using Cloudflare","_seopress_titles_desc":"How to get your own domain and route traffic to a static IP address home server using Cloudflare","_seopress_robots_index":""},"categories":[1],"tags":[13,11,6,12,5],"_links":{"self":[{"href":"https:\/\/neutronxinnovation.com\/blog\/wp-json\/wp\/v2\/posts\/102"}],"collection":[{"href":"https:\/\/neutronxinnovation.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/neutronxinnovation.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/neutronxinnovation.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/neutronxinnovation.com\/blog\/wp-json\/wp\/v2\/comments?post=102"}],"version-history":[{"count":18,"href":"https:\/\/neutronxinnovation.com\/blog\/wp-json\/wp\/v2\/posts\/102\/revisions"}],"predecessor-version":[{"id":184,"href":"https:\/\/neutronxinnovation.com\/blog\/wp-json\/wp\/v2\/posts\/102\/revisions\/184"}],"wp:attachment":[{"href":"https:\/\/neutronxinnovation.com\/blog\/wp-json\/wp\/v2\/media?parent=102"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/neutronxinnovation.com\/blog\/wp-json\/wp\/v2\/categories?post=102"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/neutronxinnovation.com\/blog\/wp-json\/wp\/v2\/tags?post=102"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}