DEV Community


Posted on • Updated on • Originally published at

Releasing jinx - a magical wrapper around nginx

This post was originally published on my personal blog.

I am super excited about this post because I made a thing! Yes, I actually made a thing with my own two hands and now I'm releasing it! I present to you: jinx

As background story, I very recently killed my entire server infrastructure by accidentally generating way too many Let's Encrypt accounts in a very short timeframe. It was super funny and I spent the better part of my Saturday getting everything back up on a backup nginx setup.

As part of that I quickly noticed a very repetitive pattern to setting up my virtual hosts. It went a little something like this for every site

# create a new site
cp \
    /etc/nginx/configurations/php.conf \

# change the host name to the new site name
nano /etc/nginx/sites-available/  

# activate the site in nginx
ln -s \
    /etc/nginx/sites-available/ \

# restart to publish newly activated sites
systemctl restart nginx
Enter fullscreen mode Exit fullscreen mode

Using ^R was a bit faster but still incredibly tedious. That's 4 different commands and I have to enter the same or a similar path a whopping four times. That just didn't feel good and so I remembered how much I wrote about shell-scripting
recently and decided to make use of it to create jinx.

With it this same process now looks like this.

# create a new site and insert hostname in template file
jinx site create php

# activate the site and restart
jinx site activate -r
Enter fullscreen mode Exit fullscreen mode

From four long, repetitive commands to two quite short ones. What a nice improvement. And it only cost me my Sunday afternoon.

The initial development effort may have been higher than setting the sites up manually but I'm still glad I did it because it was fun to do and I can reuse it all the time. Every time I create a new virtual host, this tool probably saves me some 2-3 minutes of repetitive typing.

There's also a few other features, but you can read up on everything in the documentation.

I freely admit that this is probably my single most useful side-project to date. Also it got the approval of Pieter Levels so I guess that counts for something!

GitHub logo pretzelhands / jinx

✨jinx - a magical nginx wrapper

jinx - a magical nginx wrapper

jinx is a wrapper script for nginx written entirely in Bash. It helps you manage your sites and configurations in a more streamlined way than working with plain shell commands.

Table of Contents


Since this is an early release of jinx, it still has some assumptions about your enviroment. Currently these are as follows:

  • Your sites are organized in two folders: sites-available and sites-enabled: The former one holding all available sites you could potentially host and the latter holding the sites that are reachable on the web.


Installation of jinx can be done in one line using the convenient installer script…

I hope you get as much joy and and practical use out of this tool as I do and I'll be trying to extend it with some more useful features such as activating HTTPS and building configurations from included snippets. We'll see how far I can take it!


Top comments (4)

nektro profile image
Meghan (she/her)

Looks great! How did you make the logo?

pretzelhands profile image

Defman has it right. I used the sparkle emoji with some text and put it all together in Sketch. :)

defman profile image
Sergey Kislyakov

Emoji + text?

hrn4n profile image

This is great! I once thought of making something like this but never got to actually do it haha