Aral Balkan

Mastodon icon RSS feed icon

Nginx: Remember to remove the default site

Photo of a Samsung S9+ phone hanging on a display in PC World. On screen is the browser showing the default nginx page for an http request to my site.

What a minute, where did my site go?

I realised yesterday that people accessing my new site for the first time via HTTP (not HTTPS), were seeing the default page for my nginx web server. I only realised it because I was trying the site out on a Samsung S9+ that I was playing with at PC World. (It’s always a good idea to test out your sites on the range of devices they have at such places. They don’t mind - in fact, you might find yourself having pleasant conversations about the state of surveillance capitalism and ethical technology with the folks who work there, like I did with Paul yesterday - and you might discover things you missed on your own setup. PC World is basically a large, free device lab.)

Anyway, a quick search on DuckDuckGo revealed the issue: I hadn’t removed the default site configuration from /etc/nginx/sites-enabled/ and it was competing with the HTTP → HTTPS redirect that I’d instructed Let’s Encrypt to set up for me.

Deleting that symbolic link fixes the problem.