4 Easy Local Simple Webserver options you’ve got to try

4 Easy Local Simple Webserver options you’ve got to try

Alright! You need to get in, test that webapp or api and get out! All you need is a quick and simple Webserver to do your testing. And although you could start installing some stack like LAMP/WAMP, JARHEAD or whatever other acronyms they got now, it might just be too much bloat to get the job done!

In this short post I’d like to show you easy options I use when I am testing a simple webpage, serverless webapp, serve some files or simply want to try something cool out.

SimpleHTTPServer (linux/mac)

This is by far the fastest and easy way I found.

If you are on a UNIX system, chances are you already have this installed in your machine, so: why not use it?

By simply navigating to the directory you want and running the following snippet on the command line:

#Python 2.7
python -m SimpleHTTPServer [PORT_NUMBER]

#Python 3
python -m http.server [PORT_NUMBER]

You will be able to have a running HTTP Webserver! Simple as that!

Now this defaults to port 8080 which in many cases might be already in use, so you can pass a desired port number to the command. Just be aware that any ports below 1024 require root access and using this command with sudo is not a good idea (!!!) since it can cause some serious security issues.


Savant Webserver (Windows)

To be fair, I haven’t use this myself. I got a bit away of the windows environment and use predominantly linux, so I haven’t had the need for something like this, however the reviews are pretty good so I thought I would list it here!

Althought their website seems it was last updated in 1998, it contains all the infos you need. So check it out here.

The TL;DR which they provide is the following:


  • Download and install Savant
  • Make sure Savant is running (the stylized ‘S’ icon in a blue box is in the system tray).
  • Start Windows Explorer, and find where you installed Savant on your system (unless you changed it during the install process, it’s at C:\Savant
  • In the root subdirectory of C:\Savant, place your HTML and image files. Make sure that the default file you want users to see when they connect to your site is named index.html
  • Your very own web site is ready to go!


Seems also pretty easy and I might give it a go in my windows VM at some point.


Lighttpd (all platforms)

This needs a bit more than the previous versions, i.e. you need to write a small configuration file.

Lighttpd is really extensible and powerful. You can make it work with php, rails and many others, however let’s keep it simple. Create a configuration file called lighttpd.conf and add the following:

server.document-root = "/var/www/servers/www.example.org/pages/" 

server.port = 3000

mimetype.assign = (
  ".html" => "text/html", 
  ".txt" => "text/plain",
  ".jpg" => "image/jpeg",
  ".png" => "image/png" 

This simple configuration will allow you to serve static content already!

The first line simply tell where the files are located, while the server.port config is self explanatory. The mimetype.assign  just assign some important types for the HTTP headers.

Important: all the files in the root directory must be readable by the user starting the webserver!

Finally you can run a command to test the configuration and see if everything is correct:

lighttpd -t -f lighttpd.conf

And if everything checks out, start the server:

$ lighttpd -D -f lighttpd.conf

Now you can go to localhost:3000 and explore your files 😉


Nginx (all platforms)

Pronounced as “engine-X”, this little lightweight but powerful webserver is gaining more and more of the market that was once dominated by tomcat. I myself prefer nginx to tomcat since the configuration is quicker and cleaner and it is a breeze to deal with. It is also easier to write config than tomcat, however I still don’t find it “super simple” for several tasks, but it is IMO the best out of whats there.

To be honest, a lot of things without proper experience can give you a look or feel of being convoluted (more of that on another post).

In order to begin using nginx we first must install it! To keep it brief, I won’t cover it here and would instead direct you to the official installation page: installation.

Now you navigate to where your nginx.conf lives and make a backup of that file. In linux the path might be something around the lines of /etc/nginx/sites-available.

We can now create a configuration for your local webserver by adding the following file to that folder or by modifying the default one (create a backup first! ):

server {
    listen 1230;
    server_name localhost;

    location / {
        root /home/fdiez/360T/;
        index index.html;

Now to validate the correctness of your file, run:

nginx -t

This will make sure that there are no syntax errors and will prevent you from restarting your server only to realize you messed it up (and now you can’t start it… server is down… people will get restless… next thing you know they are running after you with torches and pitchforks!).

If everything is alright than you can (re)start the service. In linux:

sudo service nginx restart
sudo systemctl restart nginx

And there is how you use nginx for your simple server needs.


Wrapping up

This list is of course not exhaustive. There are many other options out there and many of which are better or worse depending on the use-case.

I hope however that in this list there was something for you and I hope you found it useful (or at least learned something new!)

Till next time!

Leave your opinion, start a discussion, share an experience or just a compliment...

%d bloggers like this: