0

Chuck Carroll · 28d · discuss

I recently switched from Namecheap shared hosting to Cloudflare Pages. I have two websites that are both plain text html files that I edit by hand (for now). For my needs, paying to host two plain text websites that take up a combined 300MB is a bit overkill. I also had previously pointed my nameservers from Namecheap to Cloudflare, and I've been using Cloudflare's Zero Trust Tunnels for a couple of services. Namecheap has been fine, but they require that you pay for SSLs certificates. Obviously, Let's Encrypt has been a fantastic option for a long time, but Namecheap makes it incredibly difficult to use a Let's Encrypt cert, requiring you to jump though hoops to do what should be a simple thing (likely because they want you to buy a certificate from them). There are some limitations with Cloudflare Pages. The main ones: filesize limit is capped at 25MB, a maximum of 20,000 files can be stored per site, there's no SFTP, and you're limited to 500 builds per month. The only issue I encountered while migrating was a 26MB PDF. My full-resolution images are well within that limit. Though not required, I also moved one of my domains to Cloudflare to simplify things. However, they don't support .is TLDs so I still have to rely on Namecheap to be the middleman to ISNIC for that. Cloudflare Pages is pretty straightforward to set up and can be done through a terminal. nodejs and npm must be installed. To avoid a root-owned global install, point it to your home directory and install wrangler with npm config set prefix ~/.local and npm install -g wrangler. To log in run wrangler login which provides a link to approve the OAuth. Then create a new project with wrangler pages project create mynewproject (or, if you already set up some projects, run wrangler pages project list). Now to push a website directory, navigate to the parent directory and run wrangler pages deploy mynewproject/ --project-name=mynewproject. In the Cloudflare Dashboard, go to Workers & Pages > "mynewproject" > Custom domains > Set up a new domain. This is where you'll enter the URL. If Cloudflare is already handling DNS, it will finish automatically in just a few minutes, otherwise you'll be provided instructions to update your DNS records. Once complete, you can verify by running dig chuckcarroll.net and it should return Cloudflare IPs (104.x/172.67.x), but you can also add something like "test.txt" to the main directory, push the update, and then visit the URL to see if "test.txt" loads. What I like about using wrangler is that I no longer have to SFTP into my Namecheap server to push out an update. When updates are pushed, it will only sync up modified and new files as opposed to reuploading the entire directory again. Admittedly, I wanted to look into Cloudflare Pages for a while. When I finally go around to it, it took only an evening to migrate. I'm no paying nothing for hosting, SSL certificates are automatic, and deploying takes just a single command. I may eventually connect the sites to a Git repo so every commit deploys automatically. Thanks for reading. Feel free to send comments, questions, or recommendations to hey@chuck.is.