Project

General

Profile

lighttpd - All routes in Slim Framework are returning 404

Added by BRUNOALBUQUERQUE over 4 years ago

I have a Ubuntu 18.04 server running lighttpd that all his sites are working. But for some reason, my Slim Framework app (that works on my local machine passing all tests) is returning 404 in all of it's routes.

My folder looks like that:

/www
/html
/api
/old_site_1
/old_site_2
/new_site
/apps
/old_app_1
/old_app_2

And my lighttpd.conf is like that:

    server.modules = (
        "mod_access",
        "mod_alias",
        "mod_compress",
        "mod_redirect",
    )

    server.document-root        = "/var/www/html" 
    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

    index-file.names            = ( "index.php", "index.html", "index.lighttpd.html" )
    url.access-deny             = ( "~", ".inc" )
    url.rewrite-if-not-file = ("^/api/new_site/.*" => "/api/new_site/index.php")

    static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )

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

    # default listening port for IPv6 falls back to the IPv4 port
    ## Use ipv6 if available
    #include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
    include_shell "/usr/share/lighttpd/create-mime.assign.pl" 
    include_shell "/usr/share/lighttpd/include-conf-enabled.pl" 

    $SERVER["socket"] == ":443" {
        ssl.engine              = "enable" 
        ssl.ca-file             = "/etc/letsencrypt/live/mysite/chain.pem" 
        ssl.pemfile             = "/etc/letsencrypt/live/mysite/merged.pem" 
    }

    $HTTP["scheme"] == "http" {
        $HTTP["host"] =~ ".*" {
        url.redirect = (".*" => "https://%0$0")
        }
    }

I'm losing my sleep over this configuration! What I'm doing wrong?


Replies (1)

RE: lighttpd - All routes in Slim Framework are returning 404 - Added by gstrauss over 4 years ago

I'm losing my sleep over this configuration! What I'm doing wrong?

a) not looking in the error log
b) not sharing whether or not this has ever worked for you
c) not sharing your lighttpd version
d) not sharing your lighttpd config in any useful way. The config is incomplete. In what you shared, do you see any code which sends traffic to your framework? What is running /api/new_site/index.php? Is it mod_cgi or mod_fastcgi? You have not shared anything which loads or configures those modules. Try lighttpd -p -f /etc/lighttpd/lighttpd.conf

Look in the logs. Is lighttpd returning 404 or is your framework returning 404? This is a forum for lighttpd, not <fill in framework here>, so we won't be able to help you if the problem is in <insert framework here>

    (1-1/1)