TinyWeb - Smallest web server for Windows
I was searching for the smallest web server for Windows which has acceptable features and can be used in production environment. Well TinyWeb by RitLabs is an incredibly small web-server for Windows with its executable file of only 67.2KB! And despite such small size, its very fast and efficient.
Advantages:
- No installation required (there is one executable file)
- Ultra-compact (83.5 KB only! - including source code)
- Consumes little memory (less than 3 MB)
- Very fast
- Free for commercial use
Website: http://www.ritlabs.com/tinyweb/
Direct download: http://www.ritlabs.com/download/tinyweb/tinyweb.zip (83.5 KB in size, includes source code). We need only tiny.exe to setup and run the web server.
How to install and run TinyWeb server?
- Create a folder named www in the C: drive. After this create two subfolders inside C:\www and name them as root and log. The root folder is the home directory of the web server from where the web pages will be served. The log folder is used by TinyWeb to create and store log files.
- Download the tinyweb.zip and extract it. Create a shortcut of tiny.exe on Desktop.
- Locate the shortcut on the desktop and right click on it. Make the following changes in the TINY - Shortcut Properties window as shown below in the screenshot.
- Add " c:\www\root" (without quotes) in the Target option.
- Write "c:\www\log" (without quotes) in the Start in option and click on Apply.
- Now create index.html file inside the c:\www\root and add following code to it.
<html>
<body>
<h1> Hello world! </h1>
</ body>
</ html>
- Thats it! Now double click on the desktop shortcut of tiny.exe and go to the following url - http://localhost.
How to stop TinyWeb server?
To stop TinyWeb server open the Task Manager (CTRL + SHIFT + ESC) and kill the process tiny.exe.
Or you can also use the command line and execute the following command: taskkill /F /IM tiny.exe
TinyWeb executes CGI applications!
Yes, TinyWeb server is also capable of executing CGI applications. An example has been given below.
- Create a new file named test.c containing the following code:
#include <cstdio>
#include <windows.h>
int main() {
setbuf(stdout, NULL);
printf("%s%c%c\n","Content-Type:text/html;charset=iso-8859-1",13,10);
printf("<html><body>Your IP address is <b>%s</b>.<br />Your browser is <b>%s</b>.</body></html>",getenv("REMOTE_ADDR"),getenv("HTTP_USER_AGENT"));
return 0;
}
- Compile the test.c using a suitable C compiler and then place the generated test.exe in the directory - c:\www\root\cgi-bin (you need to create a directory named cgi-bin inside root folder).
- Now go to http://localhost/cgi-bin/test.exe.