Easy and Shareable Local Web Servers with Fenix
The modern web is always changing, and this article is more than two years old.
As a web developer, I long gave up thinking about my web server. I have been using Apache for over ten years now and frankly – it just works. The only time I really think about it is when I start a new project and go in to modify the configuration. While this works, I’ve discovered that sometimes it can be a bit of a hassle. As an example – I’ll have a code sent to me that doesn’t like to run in a random folder on my local web server. Or maybe I simply don’t want to copy it into my local web server. There are times when it is just convenient to have options outside of Apache, and today I’m going to discuss a new one, Fenix.
Fenix, available at http://fenixwebserver.com/, is a free, open source application available for Windows and OSX. It runs as a windowed application (and therefore must be manually started) or via the command line. I assume that most folks will use the application so let’s take a look at that first.
Of course, out of the box, nothing is configured. Unlike a “traditional” web server, Fenix doesn’t assume any default web server. It simply waits for you to tell it what to serve up. You can add a server simply enough – click the “Web Servers” button the top nav to open up a prompt.
Note that the port was set for me. Fenix is smart enough to sniff for an available port and select one. After you select a folder and create it, you can then start or stop it from the UI:
As you can see, it has some slight formatting issues with long path names. I’ve already filed a bug report for that and it will be corrected soon. The application also makes use of “cute” little animations that become annoying rather quickly. I’ve been told those will be going away as well. Remember folks – any time you add an animation to an application, imagine running it one million times and decide if you still think it is worthwhile. It probably isn’t.
Once you try to start it, you may run into the following:
In this case, either the port wasn’t really free or something else went wrong. But what I really dig about Fenix is that it just fixed it. Once started up, you can, of course, click on it to open the site in the browser.
Like a typical web server, it comes with an automatic directory browser:
It will also automatically render Markdown files into HTML. But outside of that, it simply serves up files as they are.
Sites also include a simple log viewer:
But, oddly, you can’t yet actually get to the text file behind this log. The current log view would be handy for looking at the past few requests but would not work for deep searching.
Another particularly cool feature is the ability to share the web server publicly. With one click, the application opens up a call to localtunnel.me and creates a dynamic path to your local server. You can then copy that link and share it with others. In my testing this did not always work well, mainly due to issues with localtunnel, but for quick sharing of sites it is a very cool feature.
Of course, if working with a graphical application is beneath you, you can also install the command line version. It basically allows for the same features as the graphical application, so I won’t bother sharing a screen shot of it. Where this gets interesting though – especially when compared to similars products like httpster or Python’s SimpleServer is that these servers persist. While I’ll often want a temporary web server to test something, I’ve also found myself using httpster quite often for the same folder again and again. Having Fenix persist these servers could be handy.
The Request Browser
A few weeks ago I reviewed ngrok, a tool that creates a publicly accessible web server just for the purposes of letting you record and monitor HTTP requests. Fenix also includes a request browser, launchable directly from the application.
By default this browser is also publicly available, but if you want, you can disable it and just test it locally. As with ngrok, I decided to test with GitHub webhooks. It handled it well:
Unlike ngrok there isn’t a simple “Replay” feature, but I’ve filed an enhancement request for this.
All in all, this is a pretty cool tool. As someone who uses the command line, I don’t always want to go to terminal to fire things up and a nice graphical tool comes in handy. As mentioned earlier, the fact that it persists is also quite handy as well. Will it replace Apache? Probably not. I like to run a web server locally that matches production, but I can definitely see Fenix being useful.