Hi, I wanted to host a personal Lemmy instance online (for just myself, I don’t think I can take the upkeep for other users - please let me know if this is not possible) and wanted to understand how to “attach” a CDN service to it.
The idea behind doing this is that I’m in the US but I’m looking to host a server in Europe. I am looking into Cloudflare’s free CDN service, but it would be great if someone could point me towards how I can configure this setup to speed up the loading time for my Lemmy instance (which is going to be far away from me, geographically).
I would also like to know about your setups and how you have hosted Lemmy.
Thanks!
Buy your domain with cloudflare, or transfer it over to them. Then just set up dns to point to you server and make sure the proxy switch is on. Pretty sure that’s all you need to do at the free tier
Hi, can I purchase my domain elsewhere? The other commenter mentioned something about changing nameservers, how would the process you describe be different from just changing nameservers (if I have a domain name from a different provider)?
It’s basically the same. Like they said, you just follow the intructions on cloudflare to change the name servers on your registrar and then you’re good
Thank you for your comment. I’m going through the cloudflare docs, and I have a question: why do we need to change our nameservers to Cloudflare’s? I know this might sound like a noob networking question but I just can’t seem to figure it out. Thanks!
No problem! You change the name servers on your registrar to cloudflare’s so that when traffic goes to your.domain, cloudflare is the one that processes the dns request.
If you kept the name servers of your registrar then the traffic would just be processed by the registrar, cloudflare wouldn’t even see the traffic.
Basically the name server defines your domain’s current dns provider.
Hope that makes sense
Ah, this is what I’m confused about. I get that traffic would need to flow through Cloudflare’s network, but why would Cloudflare require me to change my nameserver for that? How about a CNAME alias instead? What are the technical limitations for which Cloudflare asks this of me? I just want to understand the working behind them asking me to change my nameservers.
Thanks!
When you make a dns request, it goes to the nameservers first to see which server is has the dns config. A CNAME record is in the dns config
I’m sorry, what I don’t understand is how does changing my nameservers to cloudflare’s nameservers help propagating my traffic through their CDN infrastructure?
Because changing your nameservers to cloudflare’s allows you to use their DNS service, which comes with the CDN infrastructure.
Here is the cloudflare dns for my lemmy server’s domain:
The switch where it says proxied means that I am using the CDN to obfuscate the real IP of the server.
Setting your nameservers is simply a requirement for Cloudflare. While they theoretically could work via CNAME – they don’t. On the other hand, their DNS is really nice and is free.
When you use their DNS, for each DNS record, you have the option to proxy traffic through Cloudflare. The proxy is what enables their CDN (and many other features such as forwarding, rewriting URLs, DDoS protection, automatic HTTPS certificates, and so on). It’s a simple on/off switch for each DNS record if you don’t want to proxy a particular host.