226

I got application server running in Windows – IIS6.0 with Zend Server to execute PHP. I am looking for lightweight static content only web server on this same machine which will relive IIS form handling static content and increase performance.

It need to be only static content web server – maximum small and maximum effective – lighttpd seems too big because allow to FastCGI.

I am looking for: Windows, static content only, fast, and lightweight.

I am using Windows Server 2003.

halfer
  • 19,824
  • 17
  • 99
  • 186
bensiu
  • 24,660
  • 56
  • 77
  • 117
  • @horse he's already got IIS, what advantages would Apache offer? – David Heffernan Feb 19 '11 at 19:30
  • Which version of Windows is your target? – Oleg Feb 21 '11 at 17:14
  • @David: What advantage would any "lightweight static content server" have over IIS? IIS is absolutely capable of serving static content - just as Apache –  Feb 21 '11 at 17:28
  • 3
    @a_horse I think that's the point I'm making. I would regard IIS and Apache as pretty similar. Heavyweight gorillas. You wouldn't switch from IIS to Apache just to serve static content. Then you'd have two servers to manage and secure and no discernible benefit! – David Heffernan Feb 21 '11 at 17:36
  • @David: I have never pictured Apache as "heavy weight" - as you can easily remove any module you don't need. But to me the original question does not really make sense - or I'm not understanding it. –  Feb 21 '11 at 17:40
  • 2
    @a_horse the lightweight servers can, for some workloads, handle much higher throughput – David Heffernan Feb 21 '11 at 17:41
  • If Windows wouldn't be a requirement, the Boa web server seems be exactly what you are searching for. http://www.boa.org/ – Martin Buberl Feb 24 '11 at 19:20
  • Can we assume that the server must support gzip content-encoding (to reduce bandwidth) but need not support any authentication methods nor SSL (restricted access, proof of server identity)? – James Crook Feb 27 '11 at 20:34
  • @james - Yes - gzip is welcome, SSL not ( speed is the goal ) – bensiu Feb 28 '11 at 02:03
  • @DavidHeffernan - I always use Heavyweight Gorilla servers. – Alex Apr 15 '15 at 14:11
  • You can try http://siteonyourdevice.com, - Http 1.1 protocol. - Http 2 protocol. - Basic & digest authentication for secure access. - Directory index. - Cross-platform support. - Open source(we only transfer web content, you can check that on next link: project sources). – Topilski Alexandr Dec 23 '15 at 12:49
  • 3
    For dev on local with static content just use: "chrome.exe --allow-file-access-from-files"; nearly every one has :), no memory footprint :v, no need to install :v, no need to config :v; no need DNS resolve :D – o0omycomputero0o Apr 06 '16 at 11:11
  • 1
    http://go-www.com/ – nbari Oct 07 '17 at 13:56
  • The question [Extremely simple web server for Windows?](https://superuser.com/questions/231080/extremely-simple-web-server-for-windows) on superuser.com names a few more. – cachius May 11 '22 at 11:59

8 Answers8

273

You can use Python as a quick way to host static content. On Windows, there are many options for running Python, I've personally used CygWin and ActivePython.

To use Python as a simple HTTP server just change your working directory to the folder with your static content and type python -m SimpleHTTPServer 8000, everything in the directory will be available at http:/localhost:8000/

Python 3

To do this with Python, 3.4.1 (and probably other versions of Python 3), use the http.server module:

python -m http.server <PORT>
# or possibly:
python3 -m http.server <PORT>

# example:
python -m http.server 8080

On Windows:

py -m http.server <PORT>
Lii
  • 11,553
  • 8
  • 64
  • 88
eSniff
  • 5,713
  • 1
  • 27
  • 31
  • 3
    thus the "OR install ActiveState python" or any other version of python :-). – eSniff May 24 '13 at 06:38
  • 2
    You can even leave out the "8000" it seems to default to port 8000. – Nick Perkins Jan 19 '14 at 15:22
  • I use it often to throw up quick pages to test if a TCP port is open, for example : echo "you made it..." > index.html; nohup python -m SimpleHTTPServer 10195 > service_startup.log 2>&1 & – eSniff Apr 09 '14 at 20:59
  • 1
    I would suggest this as solution number one to developers working on Linux or MacOS, where Python is quite possibly already there. – mico Sep 25 '15 at 11:08
  • 8
    This is the single most useful thing I have read all day. I, bearer of @CamiloMartin's cannon ball, have been banging my head, trying to make Apache run on Cygwin. Like a terrible nitemare. And all to serve static content. eSniff-ster: Brilliant. – kevinarpe Feb 16 '16 at 09:56
  • 5
    This is simply awesome! Solves all my needs and works much better than the Mongoose server (python handles all url-encoded paths flawlessly). – Sverrir Sigmundarson Nov 04 '16 at 09:36
  • 1
    Why would you need Cygwin or ActivePython installed? Any installation of Python will work, particularly the default installation that most devs would have. – SilverbackNet Jul 15 '17 at 11:28
  • @SilverbackNet Any version of python would work. I haven't used windows for many years, but back then I only ever used Cygwin and IronPython windows. – eSniff Oct 06 '17 at 22:14
  • the python simplehttp server started from command line doesn't seem to support PHP. But PHP does. https://stackoverflow.com/questions/12235876/python-simplehttpserver-with-php `start php -S 127.0.0.1:80 -t .` (Note I suggest using start, to keep your current cmd window available.. like that, or running a bat that starts the web server with start) – barlop Feb 26 '18 at 00:53
  • @barlop The OP was how to host static files. Php, etc would be a different question :), but thanks for linking to the php answer for those looking for that. – eSniff May 08 '18 at 21:19
  • 1
    @eSniff That DOES host static files. If you make an index.html and have it in e.g. the root directory and got there, it will display index.html – barlop May 08 '18 at 22:33
  • 1
    Sort of an aside, but `php -S localhost:8080` will as well. It serves static content, but unfortunately also executes php files as though it were mod_php. This may work for some. – James M. Lay Aug 09 '18 at 03:21
  • @CamiloMartin The files are dead, aren't they? I'm happy with my swiss-army cannonball. Having access to a functional `bash` environment on Windows is immensely useful. – aroth Sep 03 '19 at 04:26
  • 1
    Why does this have so many upvotes! What about the constraint `lightweight` – Sudip Bhattarai Mar 01 '20 at 08:25
198

Have a look at mongoose:

  • single executable
  • very small memory footprint
  • allows multiple worker threads
  • easy to install as service
  • configurable with a configuration file if required
Bruno Brant
  • 8,226
  • 7
  • 45
  • 90
ARF
  • 7,420
  • 8
  • 45
  • 72
  • 4
    Crashes are not something I have experienced so far. – ARF Jan 31 '13 at 19:14
  • Worked for me. One problem when serving unicode text file. – Colonel Panic Sep 26 '14 at 15:02
  • Not really fast when the served files are large (like > 500KB) then it gets serious performance problems. – Lothar Mar 11 '15 at 05:06
  • 8
    Mongoose is no longer free. The Uniform Server (http://www.uniformserver.com/) is a lightweight server solution for running a web server under the Windows OS. It includes the latest versions of Apache2, Perl5, PHP5, MySQL5, phpMyAdmin and more. No installation required. No registry dust. Just unpack and fire up. – Piotr Apr 14 '16 at 13:35
  • 1
    @Piotr I am not sure what you mean by "mongoose is no longer free": It is dual-licensed GPL2 and commercial. GPL2 is clearly a free license. Furthermore until [commit 04fc209](https://github.com/cesanta/mongoose/tree/04fc209644b414d915c446bb1815b55e9fe63acc)(including) in August 2013 it was distributed under what amounted to a copyleft license. You can still use that if the GPL2 is an issue for you. – ARF Apr 14 '16 at 18:02
  • 2
    I just put it in the root folder of the static website, and run it, that's all! – simo May 03 '16 at 12:31
  • 1
    Mongoose is very nice and simple. Unfortunately it does not support url encoded accented characters (basically if the file name contains any non ASCII character mongoose doesn't serve it) – Sverrir Sigmundarson Nov 04 '16 at 09:32
  • 1
    user guide https://docs.cesanta.com/mongoose_binary/dev/#/config-file/ – Kalpesh Soni Dec 01 '16 at 22:33
  • for me it doesnt listen to remote requests, only locally it works, give up – Kalpesh Soni Dec 01 '16 at 22:39
  • 13
    I got annoyed that mongoose became so commercialized so I made a simple Golang based static server and released on GitHub: https://github.com/ethanpil/sheret – ethanpil May 26 '17 at 19:58
  • @ethanpil Looks very interesting. I tried to run the binary you provided on Windows 8.1 but got a Windows error message "This app can't run on your PC". One thing that made mongoose popular was that binaries were provided. Maybe you could fix this? – ARF Jul 13 '17 at 19:15
  • 1
    @ARF maybe I built a 64bit binary and you are on a 32bit system? – ethanpil Jul 13 '17 at 21:07
  • 1
    @ethanpil I am indeed using a 32bit system. Could you provide a 32bit version of the executable? That would also run on 64bit systems. – ARF Jul 16 '17 at 18:09
  • 7
    Mongoose binary fails windows virus detection. – Jurgen Strydom Aug 04 '18 at 17:20
  • @Jurgen Check the category the virus check reports, but _probably_ it’s just the fact that it tries to listen on external ports. – Alex Shpilkin Dec 22 '18 at 17:00
  • Antivirus detection rate 21/70: https://www.virustotal.com/gui/file/e133d6a314bd1c91c461c7cb2a53db66a7452289f32d4b7acf0af6b9659456f6/detection – Gabriel Feb 06 '20 at 15:21
  • Yes but with things that sound more like heuristics or part of other detections. I assume that the tool was abused in some malware, that doesn't make the tool itself bad. – CherryDT Jun 26 '20 at 09:33
  • 1
    I've found [CivetWeb](https://github.com/civetweb/civetweb) to be a good replacement (it was forked from mongoose in 2013). – kwc Aug 28 '20 at 03:58
  • Look at the آHadid web server [link](https://github.com/alefsoft1/hadid-web-server). –  Feb 10 '21 at 20:47
7

The smallest one I know is lighttpd.

Security, speed, compliance, and flexibility -- all of these describe lighttpd (pron. lighty) which is rapidly redefining efficiency of a webserver; as it is designed and optimized for high performance environments. With a small memory footprint compared to other web-servers, effective management of the cpu-load, and advanced feature set (FastCGI, SCGI, Auth, Output-Compression, URL-Rewriting and many more) lighttpd is the perfect solution for every server that is suffering load problems. And best of all it's Open Source licensed under the revised BSD license.

Edit: removed Windows version link, now a spam/malware plugin site.

Tracker1
  • 19,103
  • 12
  • 80
  • 106
Ophir Yoktan
  • 8,149
  • 7
  • 58
  • 106
3

Consider thttpd. It can run under windows.

Quoting wikipedia:

"it is uniquely suited to service high volume requests for static data"

A version of thttpd-2.25b compiled under cygwin with cygwin dll's is available. It is single threaded and particularly good for servicing images.

Synetech
  • 9,643
  • 9
  • 64
  • 96
James Crook
  • 1,600
  • 12
  • 17
1

Have a look at Cassini. This is basically what Visual Studio uses for its built-in debug web server. I've used it with Umbraco and it seems quite good.

ProfK
  • 49,207
  • 121
  • 399
  • 775
1

I played a bit with Rupy. It's a pretty neat, open source (GPL) Java application and weighs less than 60KB. Give it a try!

Community
  • 1
  • 1
das_weezul
  • 6,082
  • 2
  • 28
  • 33
1

You can try running a simple web server based on Twisted

ypercubeᵀᴹ
  • 113,259
  • 19
  • 174
  • 235
1

nginx or G-WAN

http://nbonvin.wordpress.com/2011/03/24/serving-small-static-files-which-server-to-use/

Antony
  • 14,900
  • 10
  • 46
  • 74
luchaninov
  • 6,792
  • 6
  • 60
  • 75
  • 5
    [nginx on Windows](http://nginx.org/en/docs/windows.html) is not the best choice. Setting it up as a service is not simple (OP wanted this), the service sometimes refuses to stop, and once every couple of months it fails to start with no explanation in the logs. – Roman Starkov Jun 29 '14 at 15:46