Skip to content

jitesoft/docker-lighttpd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

99 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lighttpd

Docker Pulls Back project

Alpine linux with Lighttpd built from source.

Lighttpd (lighty) is a lightweight web-server which is designed and optimized for high performance environments. Lighttpd is open source under the revised BSD license.

To add a new configurations (more than the default configuration), add a new *.conf file to the /usr/local/lighttpd.d directory. Each file in that directory will be included into the configuration.
If you wish to replace the base configuration fully, replace the /etc/lighttpd/conf.d/lighttpd.conf file or add a new file and change the CONFIG_FILE env variable to your preferred path.

Deprecation of FPM / introduction of CGI

The -fpm tagged images are deprecated as of 2021-11-28 and will stop receiving updates.
For a replacement, see the -cgi tagged images, which will be similar but with some differences.

Tags

Tags are based on lighttpd version where latest is the latest version at build time.
Older versions are not re-built, only latest version.

Images can be found at:

  • Docker hub: jitesoft/lighttpd
  • GitLab: registry.gitlab.com/jitesoft/dockerfiles/lighttpd
  • GitHub: ghcr.io/jitesoft/lighttpd
  • Quay quay.io/jitesoft/httpd

Dockerfiles can be found at GitLab and GitHub.

The image

This image contains lighttpd built from source, it runs on the alpine linux distro, making it a small image keeping the disk, cpu and ram at a minimum!

www-data user

Prior to 2021 07 23, the image used the user lighttpd (1000/1000) to run the image.
This have been changed to use the default www-data group and a www-data user with id 82 to comply with standard www-data user in alpine images.

Containers created runs as root (easily changed in production with the appropriate flags), while the lighttpd process runs as the www-data user (82) by default.

Environment variables

The following environment variables are used and exposed in the dockerfile:

PORT=80
SERVER_NAME=localhost
SERVER_ROOT=/var/www/html
CONFIG_FILE=/etc/lighttpd/lighttpd.conf
SKIP_HEALTHCHECK=false
MAX_FDS=1024

The default configuration file is located at /etc/lighttpd/lighttpd.conf but your own can be included in whatever way you wish. If you are not replacing the default file you can use the CONFIG_FILE variable to point to your own file and ignore the default. PORT 80 is exposed and used by default, if changed, the default configuration will use the port defined in the env variable but you will have to expose it by yourself. SERVER_NAME defaults to localhost. SERVER_ROOT defaults to /var/www/html.

The SKIP_HEALTHCHECK flag will, if set to "true" mark the container as healthy as long as it is running, while if left default or set to "false" will run a query on the 127.0.0.1:${PORT} endpoint every minute.
It's exposed as an environment variable due to the fact that a 404 will be reported as an error and exit the health check with a none-0 exit code.

The MAX_FDS variable sets the maximum file descriptors used by lighttpd and could be tweaked if needed.

CGI tag

The cgi tagged image have mod_fastcgi enabled with env variables set to enable connection to a separate cgi host. The lighttpd container will await the cgi host before starting by checking the host with nc (netcat, busybox version).

CGI_HOST="fpm"
CGI_PORT="9000"
CHECK_LOCAL="enable"
CGI_FILE_EXT=".php"

If you do not want to share data between your containers, set the CHECK_LOCAL to "disable" to ignore local files in the lighttpd container.

The default configuration (which resides in /etc/lighttpd/conf.d) contains the following configuration:

server.modules += ("mod_fastcgi")
fastcgi.server += ( env.CGI_FILE_EXT =>
        ((
                "host" => env.CGI_HOST,
                "port" => env.CGI_PORT,
                "broken-scriptfilename" => "enable",
                "docroot" => env.SERVER_ROOT,
                "check-local" => env.CHECK_LOCAL

        ))
)

Once the cgi container have connected, it will create an empty file in /tmp/ready which can be used as a startup indicator if needed.

Image labels

This image follows the Jitesoft image label specification 1.0.0.

Licenses

This repository is released under the MIT license.
You can find the Lighttpd license here.

Sponsors

Jitesoft images are built via GitLab CI on runners hosted by the following wonderful organisations:

Oregon State University - Open Source Lab

The companies above are not affiliated with Jitesoft or any Jitesoft Projects directly.


Sponsoring is vital for the further development and maintaining of open source.
Questions and sponsoring queries can be made by email.
If you wish to sponsor our projects, reach out to the email above or visit any of the following sites:

Open Collective
GitHub Sponsors
Patreon