Tip for everyone posting their works to HN – address scaling for your site before it reaches the front page. It can be as simple as pressing two buttons on Cloudflare. You aren't going to get exposure like this often, and you don't want to blow it.
Is there any dynamic content generation involved? I am wondering because the Gateway timeout hints at something behind nginx being the bottleneck. Don't you just serve static files? Maybe you could configure nginx to cache dynamic resources if they only change once a day or even consider turning dynamic resources into static resources by generating them once per day and serving them as static files.
I just modified the server to serve all images from a cloudflare-based source, hope that will help
Also, it's definitely not just static stuff, it tracks full statistics on how people did in the puzzles so they can compete, and I didn't go very deep on optimizing that yet
all stuff I don't know but I should