Useful NGINX Command Lines and Config Stuff
Last Updated On: 2025-09-01 04:31:52 -0400
Having just did a massive rewrite of two of my blogs:
Sidebar: About This Type of Blog Post
I write this style of blog post a lot:
- I do something.
- I know that I’m going to have to do it again in the future.
- I write down the important bits of what I did.
I don’t claim that this is magical or significant knowledge here – what it is though is a distillation of several hours of work and dozens of google searches / opened and discarded browser tabs.
If you’re a practicing software engineer / side project hacker / person who builds stuff online, I’d encourage you to follow this type of practice:
- It is surprisingly useful – I’m absolutely the biggest reader of my own blog (and that’s ok); I stop here before to find something before I look anywhere else.
- It improves your tech writing skills like no other activity.
Generate Your Config Online
I used the Digital Ocean config generator here. My exact config that it generated can be found here.
The errors I had (and at least part of them were mine):
- It always includes php support even when you toggle it off
- It doesn’t automatically assume index.html for index so you have to manually edit this
- It inconsistently uses $base
- It assumed public as my output dir even when my path included it (but I see why and I’m in the wrong here)
- It assumes **ssl_dhparam /etc/nginx/dhparam.pem; ** which my nginx install didn’t have so I commented this out; no I don’t know if this was good or bad but the fix here didn’t work so I just removed it and things worked
Useful Command Lines
Here are the commands I used:
To get my lets encrypt working:
certbot
To restart nginx:
systemctl restart nginx
To check my nginx config:
nginx -t
To symlink both sites:
ln -s /etc/nginx/sites-available/recipes.fuzzyblog.io.conf /etc/nginx/sites-enabled/
ln -s /etc/nginx/sites-available/new.fuzzyblog.io.conf /etc/nginx/sites-enabled/
To check nginx’s status:
systemctl status nginx.service
Thank You
Thanks to:
- Nick Janetakis for NGINX advice
- Jared White and the BridgetownRB folk for making such a delightful blogging tool (all of this is published via BridgetownRB)