In the Alpine Linux wiki the installation of lighttpd is well documented. But a simple tutorial for beginner was missing. To be more specific, just a tutorial about installing lighttpd to server simple html pages. This blog post is a summary of the original wiki article.
Installation
lighttpd is available in the Alpine repositories. To install, simple launch the command below:
1 |
apk add lighttpd |
Configuration
If you just want to server simple HTML pages lighttpd can be used out-of-box. No further configuration needed.
Start lighttpd
1 |
/etc/init.d/lighttpd start |
You will get a feedback about the status.
1 2 |
* Caching service dependencies [ ok ] * Starting lighttpd... [ ok ] |
- Restart:
/etc/init.d/lighttpd restart
- Stop:
/etc/init.d/lighttpd stop
Runlevel
Normally you want to start the web server when the system is launching. This is done by adding lighttpd to the needed runlevel.
1 |
rc-update add lighttpd default |
Testing Lighttpd
This section is assuming that lighttpd is running. If you now launch a web browser from a remote system and point it to your web server, you will see a page that says “404 – Not Found”.
http://IP-ADDRESS/
At the moment there is no content to show. Let’s add a simple test page.
1 |
echo "Lighttpd is running..." > /var/www/localhost/htdocs/index.html |
Now you will get the test page if you reload.
The full tutorial is available in the Alpine Linux wiki.