Why does 404 everything?

I have index.html file, 404
I specify a text file, 404
I copy the html file to .php and it works?

What stupid config file mistake do I have?

· · Web · 1 · 0 · 0

@M0YNG You can run lighttpd with the -t option to test the config file. And you can run it with -tt to test the config file, and load and initialize modules. The daemon will immediately exit either way.

@M0YNG Then at least you don't have any configuration file errors. But it sounds like lighttpd is set to use a server root directory different from what you're actually putting files in. I'd check that next.

@ND3JR I thought so too, but if I put index.php in the same directory, it serves that file no issue

@M0YNG So at least your CGI or FastCGI config is correct.

There's a config item called index-file.names in the main lighttpd.conf file. What do you have that set to?


( "index.php", "index.html" )

but worth noting that it gives 404 on ANY (static?) file, e.g. txt png gmi etc.

@M0YNG Forgot to ask about the value of server.document-root, which is where lighttpd is looking for files to serve. It's usually "server_root + "/htdocs" by default.

Also, there's most likely an error log that you can check. Try /var/log/lighttpd. At least that's true on NetBSD. I can't make any guarantees on Linux, especially if they tied it in to systemd-journald.

@ND3JR I probably should have mentioned that I'm trying to use virtual hosts here.

But even so - I do have the server.document-root set correctly - the index.php file is the one I'd expect for the given hostname and path given.

From the log:
GET / HTTP/1.1" 404 341 (when it's index.html)
GET / HTTP/1.1" 200 371 (when it's index.php)

@M0YNG In that case you'll need to check the server.document-root for the virtual host. Note that the last matching setting wins. The other thing I'd check is the file permissions, owner, and group on, say, index.html versus index.php

@ND3JR ah ha. The order thing helped me find a rewrite condition that was global, and applying to EVERY host, not just the one it should have.

Now it works!

Thanks for your help, have a cookie 🍪

@M0YNG It's always the little things! You're welcome! And next time you encounter something like this printing out the parsed config file may be useful:

lighttpd -f /path/to/config -p

Sign in to participate in the conversation

Mastodon.Radio is a community space for the Amateur (Ham) Radio community. Come join us and talk radio, technology, and more!