Mini httpd with Haserl: Difference between revisions

From Alpine Linux
No edit summary
m (Changed hyperlink to https)
Line 1: Line 1:
{{DISPLAYTITLE:mini_httpd with Haserl}}
{{DISPLAYTITLE:mini_httpd with Haserl}}
[http://acme.com/software/mini_httpd/ mini_httpd] is a small HTTP server. Its performance is not great, but for low or medium traffic sites it's quite adequate. It implements all the basic features of an HTTP server.
[https://acme.com/software/mini_httpd/ mini_httpd] is a small HTTP server. Its performance is not great, but for low or medium traffic sites it's quite adequate. It implements all the basic features of an HTTP server.


[http://haserl.sourceforge.net/ Haserl] is a small program that uses shell or Lua script to create cgi web scripts. It is intended for environments where PHP or ruby are too big.
[https://haserl.sourceforge.net/ Haserl] is a small program that uses shell or Lua script to create cgi web scripts. It is intended for environments where PHP or ruby are too big.


= mini_httpd setup =
= mini_httpd setup =

Revision as of 21:40, 26 July 2023

mini_httpd is a small HTTP server. Its performance is not great, but for low or medium traffic sites it's quite adequate. It implements all the basic features of an HTTP server.

Haserl is a small program that uses shell or Lua script to create cgi web scripts. It is intended for environments where PHP or ruby are too big.

mini_httpd setup

For setting up mini_httpd please see article mini_httpd

Haserl setup

Haserl package is available in the Alpine Linux repositories. To install it run:

apk add haserl

You need to modify mini_httpd.conf (to add cgipat)

vi /etc/mini_httpd/mini_httpd.conf

## do not leave empty lines in here!
#host=www.example.org
port=80
user=minihttpd
dir=/www
cgipat=**.sh|**.cgi
nochroot

mini_httpd service should be restarted because we have changed it's configuration

rc-service mini_httpd restart

Creating sample bash script

vi /www/test.sh

#!/usr/bin/haserl
content-type: text/plain

<%# This is a sample "env" script %>
<% env %>

Setting execution permission

chmod +x /www/*.sh

Troubleshooting

For troubleshooting you can try running commands:

/www/test.sh

/usr/bin/haserl /www/test.sh

apk add sudo sudo -u minihttpd /usr/bin/haserl /www/test.sh

apk add curl curl http://localhost/test.sh

mini_httpd with Haserl and Lua

Lua is a powerful, efficient, lightweight, embeddable scripting language. It supports procedural programming, object-oriented programming, functional programming, data-driven programming, and data description.

For setting up mini_httpd with Haserl and Lua, please, see arcticle mini_httpd with Haserl and Lua