#!/bin/sh . /usr/lib/libmodcgi.sh [ -r /etc/options.cfg ] && . /etc/options.cfg virthost_conf() { #$1 string of input-tag name-attribute #$2 variable containing current value to display in input field #$3 name to display if [ "$FREETZ_PACKAGE_LIGHTTPD_MOD_EVHOST" = "y" -a "$LIGHTTPD_VIRTHOST" = "yes" ]; then cat << EOF

$(lang de:"In folgender Box werden die virtuellen Hostnamen angegeben, für welche die Konfiguration bezüglich $3 gilt. Es können entweder der vollständige Hostname oder ein regulärer Ausdruck für mehrere Hostnamen verwendet werden. Mehrere Werte können angegeben werden, in dem diese mit Leerzeichen getrennt werden. Wenn die Konfiguration generell für alle virtuellen Hosts gelten soll, ist die Box leer zu lassen." en:"Please specify the virtual hosts the configuration of $3 applies to in the following box. You can either provide a full qualified domain name or a regular expression to match multiple host names. When supplying multiple values, please separate them using a space character. In case the configuration applies to all virtual hosts, leave the box empty.")

$(lang de:"Virtuelle Hosts" en:"Virtual hosts"):

EOF fi } check "$LIGHTTPD_ENABLED" yes:auto "*":man check "$LIGHTTPD_CHROOT" yes:chrooten "*":chrootdi check "$LIGHTTPD_DIRLISTING" enable:dirlista "*":dirlistd check "$LIGHTTPD_SSLENABLE" enable:sslenaba "*":sslenabd check "$LIGHTTPD_SSLADDITIONAL" yes:ssladdly no:ssladdln check "$LIGHTTPD_SSLREDIRECT" yes:sslredirect check "$LIGHTTPD_LOGGING" yes:log check "$LIGHTTPD_MODCGI" yes:modcgi check "$LIGHTTPD_MODFASTCGIPHP" yes:modfastcgiphp check "$LIGHTTPD_MODFASTCGIRUBY" yes:modfastcgiruby check "$LIGHTTPD_MODCOMPRESS" yes:modcompress check "$LIGHTTPD_ERROR" yes:error check "$LIGHTTPD_AUTH" yes:auth check "$LIGHTTPD_MODSTATUS" yes:modstatus check "$LIGHTTPD_MODSTATUSSORT" enable:modstatussort check "$LIGHTTPD_AUTHMETH" basic:authbasic digest:authdigest check "$LIGHTTPD_LOGGING_ACCESS_FILE" yes:accesslog_file "*":accesslog_syslog check "$LIGHTTPD_LOGGING_ERROR_FILE" yes:errorlog_file "*":errorlog_syslog check "$LIGHTTPD_VIRTHOST" yes:virthost sec_begin '$(lang de:"Starttyp" en:"Start type")' cat << EOF

EOF sec_end sec_begin '$(lang de:"Web Server" en:"Web server")' cat << EOF

$(lang de:"Server binden an Port" en:"Listen on port"):

EOF dirs=$LIGHTTPD_DOCROOT [ "$LIGHTTPD_CHROOT" = "yes" ] && dirs="$dirs/websites" [ "$LIGHTTPD_VIRTHOST" = "yes" ] && dirs="$dirs/default
  • $dirs/$LIGHTTPD_VIRTHOSTTYPE" dirs="" cat << EOF

    $(lang de:"Das im Folgenden angegebene Datenverzeichnis muss existieren, da lighttpd sonst nicht startet." en:"The document root directory must exist as otherwise lighttpd will not start.")

    $(lang de:"Verzeichnis der Daten" en:"Document Root"):

    $(lang de:"Soll das angegebe Datenverzeichnis auch als chroot-Verzeichnis genutzt werden?" en:"Shall the document root directory used as chroot directory?")

    $(lang de:"Bitte beachte, dass bei einem aktivierten chroot, folgende Eigenschaften gelten relativ zum oben angegebenen Datenverzeichnis, welches das chroot-Verzeichnis ist: Datenverzeichnisse werden im Verzeichnis /websites/default und virtuelle Hosts im Verzeichnis /websites/<extension> gesucht, alle sonstigen Pfadkonfigurationen müssen unterhalb des chroots liegen. Falls FastCGI konfiguriert wird, müssen alle FastCGI Programme und all ihre Bibliotheken innerhalb des chroots liegen - falls das Programm ldd vorhanden ist, wird dies automatisch durchgeführt." en:"Please note that with an activated chroot, the following properties apply relative to the above supplied docroot directory which becomes the chroot directory: the docroot will be searched in /websites/default and virtual hosts in /websites/<extension>, all other path configurations are to be supplied relative to the chroot directory. If FastCGI is configured, all FastCGI programs and their libraries must be found within the chroot - if the ldd program exists, this will be done automatically.")

    $(lang de:"Entsprechend der Konfiguration sucht lighttpd deine HTML und andere Dateien in folgenden Verzeichnis(sen) - Anzeige wird nach jeder Speicherung aktualisiert:$dirs" en:"Based on the configuration lighttpd is looking for your HTML and other files in the following directories - the listing is updated after each save:$dirs")

    EOF sec_end sec_begin '$(lang de:"Virtuelle Hosts" en:"Virtual Hosts")' if [ "$FREETZ_PACKAGE_LIGHTTPD_MOD_EVHOST" = "y" ]; then cat << EOF

    $(lang de:"Das Verzeichnis der Daten (Document Root) der virtuellen Hosts setzt sich zusammen aus dem Verzeichnis der Daten (Document Root) welches oben angegeben wurde plus der Erweiterung welche im Folgenden gewählt wird (<docroot>/<extension>). Falls das Datenverzeichnis mit der gewählten Extension existiert, wird dieses Verzeichnis als Datenverzeichnis des virtuellen Hosts verwendet. Falls dieses Verzeichnis nicht existiert, wird das oben gewählte Datenverzeichnis plus \"/default/\" als Datenverzeichnis verwendet. Dies bedeutet, dass bei aktivieren virtuellen Hosts das oben gewählte Datenverzeichnis nicht mehr direkt verwendet wird.
    lighttpd wird nur starten, wenn bei aktivierten virtuellen Hosts das default/ Datenverzeichnis existiert.
    ACHTUNG: Überlege genau, welche Option die richtige ist, vor allem im Zusammenspiel mit Zugriffskontrolle oder SSL (zum Beispiel kann die Zugriffskontrolle, welche nur für einen virtuellen Host konfiguriert wurde, einfach ausgehebelt werden, wenn du die Option \"%3\" wählst und einen DNS Namen domain.topleveldomain auf deine Box zeigen lässt)! Meist ist die Option \"%3.%0\" für den gesamten Hostnamen die richtige.
    Für Informationen bezüglich der erlauben Konfigurationsoptionen siehe hier." en:"The document root of the virtual host is defined by combining the above configured document root plus the extension selected as follows (<docroot>/<extension>). If the directory for the virtual host does not exist, the above configured document root extended with \"/default/\" is used as document root. This also means that with activated virtual host support, the above configured document root will not be used directly any more.
    lighttpd will only start if the the default/ document root exists.
    ATTENTION: be careful to select the right option (e.g. configuration of virtual hosts where one host is access-protected, the access check is easily circumvented when selecting only \"%3\" and having an DNS entry of domainname.topleveldomain)! In most cases, you want to select the option \"%3.%0\".
    For details on the allowed configuration, please see here.")

    $(lang de:"Datenverzeichnis-Erweiterung" en:"Document root directory extension"):

    EOF else cat << EOF

    $(lang de:"Virtuelle Hosts können nicht konfiguriert werden - mod_evhost.so nicht vorhanden." en:"Virtual hosts support cannot be configured - mod_evhost.so unavailable.")

    EOF fi sec_end sec_begin '$(lang de:"Erlaube Auflistung des Verzeichnisinhalts" en:"Allow listing of directory contents")' if [ "$FREETZ_PACKAGE_LIGHTTPD_MOD_DIRLISTING" = "y" ]; then cat << EOF

    $(lang de:"Kodierung der Dateinamen" en:"File name encoding"):

    EOF virthost_conf "dirlistingvirt" "$LIGHTTPD_DIRLISTINGVIRT" '$(lang de:"Verzeichnisauflistung" en:"directory listing")' else cat << EOF

    $(lang de:"Auflistung des Verzeichnisinhaltes nicht möglich - mod_dirlisting.so nicht vorhanden." en:"Listing of directory contents not available - mod_dirlisting.so unavailable.")

    EOF fi sec_end sec_begin '$(lang de:"SSL Unterstützung" en:"SSL support")' if [ "$FREETZ_PACKAGE_LIGHTTPD_WITH_SSL" = "y" ]; then cat << EOF

    $(lang de:"Damit lighttpd mit SSL-Unterstützung gestartet werden kann, müssen Zertifikat & Schlüssel hier eingetragen sein." en:"To start lighttpd with SSL-Support you have to setup Certifikat&Key here.")

    $(lang de:"Falls das Zertifikat mit einer CA signiert wurde, trage bitte das CA Zertifikat hier ein." en:"In case the certificate was signed with a CA, please provide the CA certificate here.")


    $(lang de:"Die SSL Unterstützung kann global als einzigstes konfiguriert werden (der oben konfigurierte Port wird verwendet) oder zusätzlich zur unverschlüsselten Verbindung konfiguriert werden. Falls die SSL Unterstützung zusätzlich gewünscht ist, sind folgende Optionen zu setzen." en:"The SSL support can be configured globally as the exclusive access method (the above configured port will be used) or in addition to the unencrypted communication. In case the SSL support is intended to be in addition to the unencrypted communication, all of the following options must be set.")

    $(lang de:"SSL Port" en:"SSL port"):

    EOF if [ "$FREETZ_PACKAGE_LIGHTTPD_MOD_REDIRECT" = "y" ]; then cat << EOF

    $(lang de:"Mit der folgenden Option wird eine Umleitung (HTTP redirect) vom unverschlüsselten Port zum SSL Port aktiviert. Diese Umleitung wird nur aktiv, wenn SSL zusätzlich zur unverschlüsselten Verbindung konfiguriert wurde. Bei der Benutzung von virtuellen Hosts werden nur die Hostnamen umgeleitet, für die eine SSL Unterstützung aktiv ist." en:"Using the following option, a HTTP redirect is activated redirecting traffic from the unencrypted port to the SSL port. This redirect is only active if SSL is configured as an additional service. When using virtual hosts, only the host names are redirected which are also configured for the SSL support.")

    EOF else cat << EOF

    $(lang de:"HTTP redirect kann nicht konfiguriert werden - mod_redirect.so nicht vorhanden." en:"HTTP redirect cannot be configured - mod_redirect.so unavailable.")

    EOF fi virthost_conf "sslvirt" "$LIGHTTPD_SSLVIRT" '$(lang de:"Aktivierung der SSL-Unterstützung" en:"activation of SSL support")' else cat << EOF

    $(lang de:"SSL Unterstützung in lighttpd nicht einkompiliert." en:"SSL support for lighttpd not compiled in.")

    EOF fi sec_end sec_begin '$(lang de:"Zugriffskontrolle" en:"Access control")' if [ "$FREETZ_PACKAGE_LIGHTTPD_MOD_AUTH" = "y" ]; then cat << EOF

    $(lang de:"Damit lighttpd Benutzer authentisieren kann, müssen Benutzer hier eingetragen sein." en:"To allow lighttpd to authenticate users, you have to add users here.")

    $(lang de:"Zugriffsrechte können hier eingetragen werden." en:"Access rights can be added here.")

    EOF else cat << EOF

    $(lang de:"Zugriffskontrolle kann nicht konfiguriert werden - mod_auth.so nicht vorhanden." en:"Access control cannot be configured - mod_auth.so unavailable.")

    EOF fi sec_end sec_begin '$(lang de:"Dynamische Webseiten" en:"Dynamic Web Pages")' if [ "$FREETZ_PACKAGE_LIGHTTPD_MOD_CGI" = "y" ]; then cat << EOF

    EOF virthost_conf "modcgivirt" "$LIGHTTPD_MODCGIVIRT" '$(lang de:"Aktivierung von mod_cgi" en:"activation of mod_cgi")' echo "
    " else cat << EOF

    $(lang de:"CGI Unterstützung kann nicht konfiguriert werden - mod_cgi.so nicht vorhanden." en:"CGI support cannot be configured - mod_cgi.so unavailable.")

    EOF fi if [ "$FREETZ_PACKAGE_LIGHTTPD_MOD_FASTCGI" = "y" ]; then cat << EOF

    EOF foundphp=$(which php-cgi) if [ ! -x "$foundphp" ]; then foundphp="" cat << EOF

    $(lang de:"Programm php-cgi wurde nicht gefunden. Bitte gib den vollständigen Pfad zu diesem Programm in folgender Box an." en:"Program php-cgi was not found. Please provide complete path to this program.")

    EOF else cat << EOF

    $(lang de:"Programm php-cgi wurde im Pfad $foundphp gefunden. Bitte gib diesen oder den entsprechenden vollständigen Pfad zu diesem Programm in folgender Box an." en:"Program php-cgi was found at $foundphp. Please either provide this or the correct path to this program in following box.")

    EOF fi if [ "x$LIGHTTPD_MODFASTCGIPHPPATH" = "x" ]; then LIGHTTPD_MODFASTCGIPHPPATH=$foundphp; fi cat << EOF

    $(lang de:"Pfad zu php-cgi" en:"Path to php-cgi"):

    $(lang de:"Maximale Anzahl der PHP Prozesse" en:"Maximum number of PHP processes"):

    EOF virthost_conf "modfastcgiphpvirt" "$LIGHTTPD_MODFASTCGIPHPVIRT" '$(lang de:"Aktivierung der PHP-FastCGI Unterstützung" en:"activation of PHP FastCGI support")' echo "
    " cat << EOF

    EOF foundruby=$(which ruby-cgi) if [ ! -x "$foundruby" ]; then foundruby="" cat << EOF

    $(lang de:"Programm ruby-cgi wurde nicht gefunden. Bitte gib den vollständigen Pfad zu diesem Programm in folgender Box an." en:"Program ruby-cgi was not found. Please provide complete path to this program.")

    EOF else cat << EOF

    $(lang de:"Programm ruby-cgi wurde im Pfad $foundruby gefunden. Bitte gib diesen oder den entsprechenden vollständigen Pfad zu diesem Programm in folgender Box an." en:"Program ruby-cgi was found at $foundruby. Please either provide this or the correct path to this program in following box.")

    EOF fi if [ "x$LIGHTTPD_MODFASTCGIRUBYPATH" = "x" ]; then LIGHTTPD_MODFASTCGIRUBYPATH=$foundruby; fi cat << EOF

    $(lang de:"Pfad zu ruby-cgi" en:"Path to ruby-cgi"):

    $(lang de:"Maximale Anzahl der RUBY Prozesse" en:"Maximum number of RUBY processes"):

    EOF virthost_conf "modfastcgirubyvirt" "$LIGHTTPD_MODFASTCGIRUBYVIRT" '$(lang de:"Aktivierung der RUBY-FastCGI Unterstützung" en:"activation of RUBY FastCGI support")' else cat << EOF

    $(lang de:"FastCGI Unterstützung kann nicht konfiguriert werden - mod_fastcgi.so nicht vorhanden." en:"FastCGI support cannot be configured - mod_fastcgi.so unavailable.")

    EOF fi sec_end sec_begin '$(lang de:"Erweiterte Einstellungen" en:"Advanced Options")' if [ "$FREETZ_PACKAGE_LIGHTTPD_MOD_COMPRESS" = "y" ]; then cat << EOF

    $(lang de:"Verzeichnis der Cache Daten" en:"Directory of Cache"):

    EOF virthost_conf "modcompressvirt" "$LIGHTTPD_MODCOMPRESSVIRT" '$(lang de:"Aktivierung von mod_compress" en:"activation of mod_compress support")' echo "
    " else cat << EOF

    $(lang de:"Dateicaching kann nicht konfiguriert werden - mod_compress.so nicht vorhanden." en:"Caching of files cannot be configured - mod_compress.so unavailable.")

    EOF fi if [ "$FREETZ_PACKAGE_LIGHTTPD_MOD_STATUS" = "y" ]; then cat << EOF

    $(lang de:"Ein leeres URL Feld deaktiviert die jeweilige Statusanzeige." en:"An empty URL field deactivates the corresponding status display.")

    $(lang de:"Falls der Webserver im Internet erreichbar ist, sollten diese URLs geschützt werden (zum Beispiel mit Zugriffskontrolle - siehe oben)." en:"In case the web server is reachable in the Internet, please consider the protection of these URLs (for example by using the access control feature - see above).")

    $(lang de:"URL für Konfiguration" en:"URL for configuration"):

    $(lang de:"URL für Statistiken" en:"URL for statistics"):

    $(lang de:"URL für Status" en:"URL for status"):

    EOF virthost_conf "modstatusvirt" "$LIGHTTPD_MODSTATUSVIRT" '$(lang de:"Aktivierung von mod_status" en:"activation of mod_status support")' echo "
    " else cat << EOF

    $(lang de:"Statusinformationen können nicht angezeigt werden - mod_status.so nicht vorhanden." en:"Status information cannot be displayed - mod_status.so unavailable.")

    EOF fi cat << EOF

    $(lang de:"Der Server kann selbst-erstellte Fehlermeldungen zurücksenden, inklusive eigene 404 Fehlerseiten. Generell können auch andere HTTP-Fehler (zum Beispiel 500) entsprechend behandelt werden. Es können ausschliesslich statische Seiten zurückgesendet werden. Das Format der Dateinamen lautet: <Fehlerdatei-Prefix><status-code>.html. Der Prefix muss dabei der absolute Pfadname auf dem Hostsystem sein, nicht nur innerhalb des Datenverzeichnisses." en:"You can customize what page to send back based on a status code. This provides you with an alternative way to customize 404 pages. You may also customize other status-codes with their own custom page (500 pages, etc). Only static files are allowed to be sent back. Format: <errorfile-prefix><status-code>.html. This path must be the absolute path name on the host system, not only starting with the docroot.")

    $(lang de:"Datei-Prefix für Fehler" en:"File prefix for error"):

    EOF virthost_conf "errorvirt" "$LIGHTTPD_ERRORVIRT" '$(lang de:"Aktivierung der Fehlerseiten" en:"activation of error pages")' cat << EOF

    $(lang de:"Die folgenden Boxen erlauben, die maximale Datentransferrate in kBytes/s festzulegen. Der Wert 0 bedeutet kein Limit. Bitte beachte, dass ein Wert von unter 32 kb/s effektiv den Verkehr auf 32 kb/s aufgrund der Grösse der TCP Sendepuffer drosselt." en:"The following boxes allw the specification of the maximum data transfer rate in kBytes/s. The value of 0 means no limit. Please note that a limit below 32kb/s might actually limit the traffic to 32kb/s. This is caused by the size of the TCP send buffer.")

    $(lang de:"Maximale Datenrate pro Verbindung" en:"Maximum throughput per connection"): kBytes/s

    $(lang de:"Maximale Datenrate aller Verbindungen" en:"Maximum throughput for all connections"): kBytes/s

    EOF virthost_conf "limitvirt" "$LIGHTTPD_LIMITVIRT" '$(lang de:"Drosselung der Datentransferrate" en:"limitation of data transfer rate")' sec_end sec_begin '$(lang de:"Server Logdateien" en:"Server log files")' cat << EOF

    $(lang de:"Bitte beachte, dass die Logdateien wertvollen RAM Speicher belegen falls das Standardverzeichnis für die Logdateien verwendet wird (siehe unten). Nutze das Logging nur für Fehlersuche und schalten es für den normalen Betrieb ab." en:"Please note that the log files use precious RAM memory if the standard directory for the log files is used (see below). Use logging only for debugging and disable it for regular operation.")

    EOF if [ "$LIGHTTPD_LOGGING" = "yes" ]; then if [ "$LIGHTTPD_LOGGING_ERROR_FILE" = "yes" ] || [ "$FREETZ_PACKAGE_LIGHTTPD_MOD_ACCESSLOG" = "y" -a "$LIGHTTPD_LOGGING_ACCESS_FILE" = "yes" ]; then cat << EOF

    $(lang de:"Logdateien anzeigen" en:"Show logfiles")

    EOF fi fi cat << EOF

    EOF if [ "$FREETZ_PACKAGE_LIGHTTPD_MOD_ACCESSLOG" = "y" ]; then cat << EOF

    $(lang de:"Speicherart des Zugriffs-Logs (Access Log)" en:"Save type of access log")

    EOF else cat << EOF

    $(lang de:"Zugriffs-Logs (Access Log) kann nicht konfiguriert werden - mod_accesslog.so nicht vorhanden." en:"Access logs cannot be configured - mod_accesslog.so unavailable.")

    EOF fi cat << EOF

    $(lang de:"Speicherart des Fehler-Logs (Error Log)" en:"Save type of error log")

    $(lang de:"In den folgenden Boxen können die absoluten Pfade zu den Logdateien geändert werden. Beachte, dass lighttpd mit der Benutzer ID wwwrun läuft und die Datei und das Verzeichnis für wwwrun schreibbar sein muss. Das Standardverzeichnis /var/log/lighttpd/ ist immer für den Benutzer wwwrun schreibbar. Falls ein anderes Verzeichnis als das Standardverzeichnis verwendet wird, erfolgt keine automatische Löschung der Logdateien, wenn logging deaktiviert wird. Wenn der Pfadname mit einem '|' beginnt, wird der im Anschluss folgende Pfadname als Prozess ausgeführt und erhält die Logdaten als Eingabe via STDIN." en:"In the following boxes, you can alter the absolute path names to the log files. Please note, the lighttpd web server runs with the user ID of wwwrun. The provided file/path must be writeable for this user ID. The default directory /var/log/lighttpd/ is always writeable for wwwrun. If you use a different directory than the default directory, the log files will not be automatically removed in case you deactivate logging. If the path name starts with a '|' the rest of the name is taken as the name of a process which will be spawned and will get the output via STDIN.")

    EOF if [ "$FREETZ_PACKAGE_LIGHTTPD_MOD_ACCESSLOG" = "y" ]; then cat << EOF

    $(lang de:"Zugriffs-Log (Access log)" en:"Access log"):

    EOF fi cat << EOF

    $(lang de:"Fehler-Log (Error log)" en:"Error log"):

    EOF sec_end