mini_httpd with Haserl and Lua
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.
Lua is a powerful, efficient, lightweight, embeddable scripting language. It supports procedural programming, object-oriented programming, functional programming, data-driven programming, and data description.
mini_httpd setup
For setting up mini_httpd please see article mini_httpd
Haserl and Lua setup
Haserl and Lua packages are available in the Alpine Linux repositories. To install them run:
apk add haserl lua
You need to modify mini_httpd.conf (to add cgipat)
Contents of /etc/mini_httpd/mini_httpd.conf
mini_httpd service should be restarted because we have changed it's configuration
rc-service mini_httpd restart
Creating sample Lua script
Contents of /www/test.lua
Setting execution permission
chmod +x /www/*.lua
Troubleshooting
For troubleshooting you can try running commands:
lua /www/test.lua
/www/test.lua
/usr/bin/haserl --shell=lua /www/test.lua
su - minihttpd /usr/bin/haserl /www/test.lua
apk add curl curl http://localhost/test.lua