Mini httpd: Difference between revisions
(→Setup) |
m (changed hyperlinks to https + nowikid an example url) |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:mini_httpd}} | {{DISPLAYTITLE:mini_httpd}} | ||
[ | [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. | ||
= Setup = | = Setup = | ||
Line 46: | Line 46: | ||
</pre> | </pre> | ||
= Testing = | == Testing == | ||
This section is assuming that mini_httpd is running and sample html page "/www/index.html" is created. Launch a web browser and point it to your web server. You should get: | This section is assuming that mini_httpd is running and sample html page "/www/index.html" is created. Launch a web browser and point it to your web server. You should get: | ||
<pre> | <pre> | ||
Line 54: | Line 54: | ||
You can also test web server with curl | You can also test web server with curl | ||
{{cmd|apk add curl | {{cmd|apk add curl | ||
curl http://localhost}} | curl <nowiki>http://localhost</nowiki>}} | ||
= | == Adding to runlevel == | ||
Normally you want to start the web server when the system is launching. This is done by adding mini_httpd to the needed runlevel. | Normally you want to start the web server when the system is launching. This is done by adding mini_httpd to the needed runlevel. | ||
{{Cmd|rc-update add mini_httpd default}} | {{Cmd|rc-update add mini_httpd default}} | ||
Line 72: | Line 72: | ||
= mini_httpd with Haserl = | = mini_httpd with Haserl = | ||
[ | [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_with_Haserl | For setting up mini_httpd with Haserl, please see article [[Mini_httpd_with_Haserl|mini_httpd with Haserl]] | ||
= mini_httpd with Haserl and Lua = | |||
[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. | |||
[https://www.lua.org 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 article [[Mini_httpd_with_Haserl_and_Lua|mini_httpd with Haserl and Lua]] | |||
[[Category:Web Server]] | |||
[[Category:Lua]] |
Latest revision as of 21:42, 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.
Setup
mini_httpd package is available in the Alpine Linux repositories. To install it run:
apk add mini_httpd
Preparing home directory
mkdir /www chown minihttpd /www
Before writing your configuration perhaps you may wish to backup original configuration file
mv /etc/mini_httpd/mini_httpd.conf /etc/mini_httpd/mini_httpd.conf.orig
Creating mini_httpd configuration file
vi /etc/mini_httpd/mini_httpd.conf
## do not leave empty lines in here! #host=www.example.org port=80 user=minihttpd dir=/www nochroot
Creating sample .html file
vi /www/index.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>HTML5</title> </head> <body> Server is online </body> </html>
Starting mini_httpd
rc-service mini_httpd start
* Starting mini_httpd ... [ ok ]
Testing
This section is assuming that mini_httpd is running and sample html page "/www/index.html" is created. Launch a web browser and point it to your web server. You should get:
Server is online
You can also test web server with curl
apk add curl curl http://localhost
Adding to runlevel
Normally you want to start the web server when the system is launching. This is done by adding mini_httpd to the needed runlevel.
rc-update add mini_httpd default
Now mini_httpd should start automatically when you launch your system next time. To test that run:
reboot
To make sure that mini_httpd is started run:
ps aux | grep mini_httpd
You should get something like this:
580 minihttp 0:00 /usr/sbin/mini_httpd -i /var/run/mini_httpd/mini_httpd.pid -C /etc/mini_httpd/mini_httpd.conf -l /var/log/mini_httpd/mini_httpd.log
mini_httpd with Haserl
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.
For setting up mini_httpd with Haserl, please see article mini_httpd with Haserl
mini_httpd with Haserl and Lua
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 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 article mini_httpd with Haserl and Lua