4

I’m looking for a self-contained HTTP web server that I can deploy to Windows and Linux machines to serve static files.

It needs to be small and basic. Preferably I would be able to launch it (and shut it down) from a command line, specifying which port it would run on, and specifying which directory it would point to as its home directory.

Anybody know of any like this?

4

I would suggest Jetty. I'm in the process of embedding this into an application. It's Java based and cross platform compatible.

You can also embed Jetty right inside your application pretty easily.

Features

  • Full-featured and standards-based
  • Open source and commercially usable
  • Flexible and extensible
  • Small footprint
  • Embeddable
  • Asynchronous
  • Enterprise scalable
  • Dual licensed under Apache and Eclipse

EDIT: I ended up using Tomcat embedded version, so I'll add that as a recommendation. Simple and easy to use from within code. And as per OP, can be started from command line.

| improve this answer | |
  • I actually ended up using Restlet, but for a new project which needs more flexibility I've been using embedded Jetty, which is working great. So I'll give this the accept – Nick May 24 '15 at 1:15
3

I have personally used Mongoose. It is fully cross-platform, and is a self contained executable. It serves static files and by default serves from the directory you start it in. You can also pass it a path on the command line if you want to serve a different directory.

Some alternatives.

  • http-server Requires node.js. Can be a production server, or a development one. Otherwise, it is identical to mongoose

Both of these options are lightweight, yet powerful, fully cross-platform, and can be installed portably (i.e. don't need administrator permissions to install)

| improve this answer | |
  • I had found Mongoose and http-server in my research. Unfortunately Mongoose's license is not permissive enough for my use, and I can't guarantee that my customers will have node.js on their systems. – Nick Mar 9 '15 at 15:46
1

You can install Apache after installing Cygwin. https://cygwin.com/

If you want something that's probably a bit easier to install & setup, you can try WAMP. http://www.wampserver.com/en/

There is also XAMP which is about the same thing. https://www.apachefriends.org/index.html

| improve this answer | |
  • Apache doesn't seems to be exactly "basic", it's configuration file can be challenging to tweak sometimes, too overkill in my opinion (but nice one for more complex than simple html files). Also, you don't need Cygwin at all, it's much better to install the native Windows version instead. – Alejandro May 24 '15 at 1:21
1

I'm not sure why you would need one that can work in either environment. Personally I would setup a Linux VM in VirtualBox using Puphpet to run a web server in Windows if I was stuck in Windows somehow.

That said, I would recommend Nginx. It is primarily for Linux. That is what it was designed for and on. However they have a native Windows version that doesn't require cygwin to run it.

| improve this answer | |
0

I have been quite happy with MiniWeb.

MiniWeb is a mini HTTP server implementation written in C language, featuring low system resource consumption, high efficiency, good flexibility and high portability. It is capable to serve multiple clients with a single thread, supporting GET and POST methods, authentication, dynamic contents (dynamic web page and page variable substitution) and file uploading. MiniWeb runs on POSIX complaint OS, like Linux, as well as Microsoft Windows (Cygwin, MinGW and native build with Visual Studio). The binary size of MiniWeb can be as small as 20KB (on x86 Linux). The target of the project is to provide a fast, functional and low resource consuming HTTP server that is embeddable in other applications (as a static or dynamic library) as well as a standalone web server.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.