|Last modified: 16-06-2020|
Simple HTTPd, a.k.a. shttpd, is a single-EXE web server available for Windows and Linux that can not only hand out static files but also run scripts through CGI. It also supports Apache's digest mechanism to protect directories with an .htpasswd file.
Release 1.38 on Windows was only GUI based so ignored command-line arguments, but 1.39 and above do read command-line arguments and they supersed those set in shttpd.conf.
Since 1.38 didn't use command-line arguments, it also didn't suppor the -A switch which made it possible to create user accounts in an .htpasswd file. As a result, we had to use Apache's htdigest.exe for this. Starting with 1.39, this feature is also available in the Windows version of Shttpd, so htdigest.exe is no longer required.
In addition to shttpd.exe and shttpd.conf:
Here's part of the php.ini:
Since Shttpd expect document_root and cgi_interpreter to contain the full path to the items, if we want to provide users with a ZIP file that they can just unzip to have a running web app, a work-around is to write an applet that they'll double-click to create the shttpd.conf on the fly, launch Shttpd, and die silently.
Here's the PowerBasic version:
The .htpasswd file must include the "realm", or SHTTPD will just loop endlessly when you're trying to access a protected resource:
If the version of SHTTPD that you have doesn't handle the -A switch to create/edit passwords, download Apache's htdigest.exe:
C:\>htdigest.exe -c .htpasswd localhost admin
The path to the CGI interpreter must be absolute, not relative