Project

General

Profile

[Solved] Screwed configuration OK, how to find what is keeping lighttpd from starting?

Added by christiann over 4 years ago

Hi folks,

I had a perfect lighttpd-configuration and did not touch it but tried to install awstats or webalizer. Both failed and did not (from my point of view) change lighttpd.conf at all but after removing the statistic-tools lighttpd refuses to start. How can I find out whats going wrong?

My attrempt so far:

root@raspberrypi:/etc/lighttpd# service lighttpd start
Job for lighttpd.service failed because the control process exited with error code.
See "systemctl status lighttpd.service" and "journalctl -xe" for details.
root@raspberrypi:/etc/lighttpd# systemctl status lighttpd.service
● lighttpd.service - Lighttpd Daemon
   Loaded: loaded (/lib/systemd/system/lighttpd.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2019-08-03 15:35:39 CEST; 10s ago
  Process: 30502 ExecStartPre=/usr/sbin/lighttpd -tt -f /etc/lighttpd/lighttpd.conf (code=exited, status=255/EXCEPTION)

Aug 03 15:35:39 raspberrypi systemd[1]: Failed to start Lighttpd Daemon.
Aug 03 15:35:39 raspberrypi systemd[1]: lighttpd.service: Service RestartSec=100ms expired, scheduling restart.
Aug 03 15:35:39 raspberrypi systemd[1]: lighttpd.service: Scheduled restart job, restart counter is at 5.
Aug 03 15:35:39 raspberrypi systemd[1]: Stopped Lighttpd Daemon.
Aug 03 15:35:39 raspberrypi systemd[1]: lighttpd.service: Start request repeated too quickly.
Aug 03 15:35:39 raspberrypi systemd[1]: lighttpd.service: Failed with result 'exit-code'.
Aug 03 15:35:39 raspberrypi systemd[1]: Failed to start Lighttpd Daemon.
root@raspberrypi:/etc/lighttpd# journalctl -xe
-- Support: https://www.debian.org/support
-- 
-- A start job for unit lighttpd.service has finished with a failure.
-- 
-- The job identifier is 20778 and the job result is failed.
Aug 03 15:35:39 raspberrypi systemd[1]: lighttpd.service: Service RestartSec=100ms expired, scheduling restart.
Aug 03 15:35:39 raspberrypi systemd[1]: lighttpd.service: Scheduled restart job, restart counter is at 5.
-- Subject: Automatic restarting of a unit has been scheduled
-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- Automatic restarting of the unit lighttpd.service has been scheduled, as the result for
-- the configured Restart= setting for the unit.
Aug 03 15:35:39 raspberrypi systemd[1]: Stopped Lighttpd Daemon.
-- Subject: A stop job for unit lighttpd.service has finished
-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- A stop job for unit lighttpd.service has finished.
-- 
-- The job identifier is 20840 and the job result is done.
Aug 03 15:35:39 raspberrypi systemd[1]: lighttpd.service: Start request repeated too quickly.
Aug 03 15:35:39 raspberrypi systemd[1]: lighttpd.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- The unit lighttpd.service has entered the 'failed' state with result 'exit-code'.
Aug 03 15:35:39 raspberrypi systemd[1]: Failed to start Lighttpd Daemon.
-- Subject: A start job for unit lighttpd.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- A start job for unit lighttpd.service has finished with a failure.
-- 
-- The job identifier is 20840 and the job result is failed.
Aug 03 15:36:01 raspberrypi CRON[30511]: pam_unix(cron:session): session opened for user root by (uid=0)
Aug 03 15:36:01 raspberrypi CRON[30515]: (root) CMD (cp -r -u ~pi/public_html/* /var/www/html)
Aug 03 15:36:01 raspberrypi CRON[30511]: pam_unix(cron:session): session closed for user root
error.log doesn't tell any more. And I have no idea what is going wrong here. How to get lighttpd back to work? lighttpd.conf is
# Pi-hole: A black hole for Internet advertisements
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
# Network-wide ad blocking via your own hardware.
#
# Lighttpd config for Pi-hole
#
# This file is copyright under the latest version of the EUPL.
# Please see LICENSE file for your rights under this license.

###############################################################################
#     FILE AUTOMATICALLY OVERWRITTEN BY PI-HOLE INSTALL/UPDATE PROCEDURE.     #
# ANY CHANGES MADE TO THIS FILE AFTER INSTALL WILL BE LOST ON THE NEXT UPDATE #
#                                                                             #
#              CHANGES SHOULD BE MADE IN A SEPARATE CONFIG FILE:              #
#                         /etc/lighttpd/external.conf                         #
###############################################################################

server.modules = (
        "mod_access",
        "mod_accesslog",
        "mod_alias",
        "mod_auth",
        "mod_expire",
        "mod_compress",
        "mod_redirect",
        "mod_setenv",
        "mod_rewrite" 
)

server.document-root        = "/var/www/html" 
server.error-handler-404    = "pihole/index.php" 
server.upload-dirs          = ( "/var/cache/lighttpd/uploads" )
server.errorlog             = "/var/log/lighttpd/error.log" 
server.pid-file             = "/var/run/lighttpd.pid" 
server.username             = "www-data" 
server.groupname            = "www-data" 
server.port                 = 80
accesslog.filename          = "/var/log/lighttpd/access.log" 
accesslog.format            = "%{%s}t|%V|%r|%s|%b" 

index-file.names            = ( "index.php", "index.html", "index.lighttpd.html" )
url.access-deny             = ( "~", ".inc", ".md", ".yml", ".ini" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )

compress.cache-dir          = "/var/cache/lighttpd/compress/" 
compress.filetype           = ( "application/javascript", "text/css", "text/html", "text/plain" )

mimetype.assign   = ( ".png"  => "image/png",
                      ".jpg"  => "image/jpeg",
                      ".jpeg" => "image/jpeg",
                      ".html" => "text/html",
                      ".css" => "text/css; charset=utf-8",
                      ".js" => "application/javascript",
                      ".json" => "application/json",
                      ".txt"  => "text/plain",
                      ".svg"  => "image/svg+xml" )

# default listening port for IPv6 falls back to the IPv4 port
include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port

# Prevent Lighttpd from enabling Let's Encrypt SSL for every blocked domain
#include_shell "/usr/share/lighttpd/include-conf-enabled.pl" 
include_shell "find /etc/lighttpd/conf-enabled -name '*.conf' -a ! -name 'letsencrypt.conf' -printf 'include \"%p\"\n' 2>/dev/null" 

# If the URL starts with /admin, it is the Web interface
$HTTP["url"] =~ "^/admin/" {
    # Create a response header for debugging using curl -I
    setenv.add-response-header = (
        "X-Pi-hole" => "The Pi-hole Web interface is working!",
        "X-Frame-Options" => "DENY" 
    )

    $HTTP["url"] =~ ".ttf$" {
        # Allow Block Page access to local fonts
        setenv.add-response-header = ( "Access-Control-Allow-Origin" => "*" )
    }
}

# Block . files from being served, such as .git, .github, .gitignore
$HTTP["url"] =~ "^/admin/\.(.*)" {
     url.access-deny = ("")
}

# Add user chosen options held in external file
# This uses include_shell instead of an include wildcard for compatibility
include_shell "cat external.conf 2>/dev/null" 

#
# Directives to allow use of AWStats as a CGI
#
Alias /awstatsclasses "/home/pi/wwwroot/classes/" 
Alias /awstatscss "/home/pi/wwwroot/css/" 
Alias /awstatsicons "/home/pi/wwwroot/icon/" 
ScriptAlias /awstats/ "/home/pi/wwwroot/cgi-bin/" 

#
# This is to permit URL access to scripts/files in AWStats directory.
#
<Directory "/home/pi/wwwroot">
    Options None
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

Replies (2)

RE: Screwed configuration OK, how to find what is keeping lighttpd from starting? - Added by christiann over 4 years ago

Far too easy, dump me! Of corse awstats changed lighttpd.conf and appended 17 lines. Removing these

#
# Directives to allow use of AWStats as a CGI
#
Alias /awstatsclasses "/home/pi/wwwroot/classes/" 
Alias /awstatscss "/home/pi/wwwroot/css/" 
Alias /awstatsicons "/home/pi/wwwroot/icon/" 
ScriptAlias /awstats/ "/home/pi/wwwroot/cgi-bin/" 

#
# This is to permit URL access to scripts/files in AWStats directory.
#
<Directory "/home/pi/wwwroot">
    Options None
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

brought lighttpd up again.

Many thanks for providing lighttpd and this forum as well ;-)

RE: [Solved] Screwed configuration OK, how to find what is keeping lighttpd from starting? - Added by gstrauss over 4 years ago

FYI: running: lighttpd -f /etc/lighttpd/lighttpd.conf -tt
is a good way to test your config and print out configuration errors which might prevent startup.

    (1-2/2)