This is a card in Dave's Virtual Box of Cards.

Local Apache Instances for Fun and Utility

Created: 2022-08-07

I’ve found all sorts of uses for running Web servers on my home network (not accessible to the outside world).

Local websites can be amazing user interfaces for shared data.

Browsers are near-universal UI engines accessible from a huge variety of devices, so when you put something on a web server on a network, you’re making an interface that pretty much anyone on that network can use from any device. Old-fashioned CGI Scripts are still an incredibly easy way to make quick user interfaces.

Running things on a local secured network means you can skip all of the security stuff like logins and passwords that you would normally need to create before exposing something on the Internet.

I hope it goes without saying that I’m not recommending exposing sensitive private data to your local network any more than I would suggest pinning confidential documents to the wall in the front entrance of your house.

Sometimes it’s really nice to do local Web development for its own sake as well. Being able to experiment locally is faster and safer than on a public-facing server.

At the moment, I’m working on a page of this website which uses a lot of embedded JavaScript and HTML to make an interactive demonstration/tutorial. To make a single change and view it, I would normally have to do a complete publishing of that page to this website before I would be able to see what it looks like because:

But I can serve the .adoc source directly and pretend it is HTML with these lines in my /etc/httpd/httpd.conf:

<Directory "/home/dave/wiki/ratf/src/">
    Require all granted
AddType text/html .adoc
Alias / /home/dave/wiki/ratf/src/

And now I can just hit http://phobos/foo.adoc and see my AsciiDoc source treated in the browser as if it were HTML.

Of course, the page is a total mess because the AsciiDoc content is not HTML, but the embedded HTML content renders just fine, which is all I need. This is a huge time-saver. Thank you to the browser creators who work so hard to have the browser render whatever it can.

Of course, I could also author the page as a plain HTML document, but that doesn’t play well with the rest of my website and makes authoring the text content less fun.