2 min read

Ways to self-host Wordle

So — you heard about this Wordle to NYT thing and you're not really about playing the NYT version OR you're scared that it'll go behind a paywall at some point.

Whatcha gonna do?

Well luckily Wordle is literally one HTML file that references a JS file, so if you wanted to you could download both of these files following the instructions listed here and just play it on your computer.

But what if you wanted to share? Well, there are a few ways you can do this. You can serve the static file on a server using something like Apache or Nginx. You could also serve the file over Github for free. Today, I'm going to go over these two methods and hopefully you can take this knowledge and use it to self-host something of your own!

Self-hosting on Github: The Free Way

The cheaper way to do this is to serve it via Github. You're going to need a Github account.

Yeah, that's about it.

Now, create a Github repository named your-username.github.io somewhere on your computer, then download the zip file containing Old Wordle and extract them into your repository. My Github username is fatcat2, so my file structure should look something like this:

- index.html
- main.e65ce0a5.js

You can download the Wordle files down here below.

Now, push these files to the repository and you should be able to see it at https://your-username.github.io!

Self-hosting it on a server

Before we go into this section, I'm going to be making a few assumptions/notes:

  1. You know how to use the command line
  2. I won't go into how to secure your server (that comes at a later time).
  3. You have a web-facing server (defined as a computer that is connected to the outer internet and is online more often than not). You can rent a server from services like AWS, DigitalOcean, GCP, etc.
  4. You are running Linux, and using nginx

The first step I'll be doing is creating a new subdomain for my new wordle site. I'll create a new record with my DNS for wordle.ryanjchen.com and point it at my server.

Next, I'll be creating a new virtual host in nginx. For me, it looks something like this. Probably not the optimal way to create a virtual host but whatever.

server {
	root /path/to/wordle/folder;
	index index.html;
	server_name wordle.ryanjchen.com;

Breaking this down: we're giving the server a name, and we're telling it where the root folder is (aka where to draw files from). Giving the server a name will differentiate it from other web applications we want to host on the same server, like a blog for instance.

And that's really about it. Hit up your URL and you're now serving a static file to the internet!