Project

General

Profile

New Raspberry Pi Install Yields 403 Forbidden at localhost

Added by radilly over 3 years ago

I did 2 installs of lighttpd the other day on Raspberry Pis. One seemed to be OK, one seems to fail with a "403 Forbidden". Here's a summary...

~ $ lighttpd -version
lighttpd/1.4.53 (ssl) - a light and fast webserver
~ $ curl localhost
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title>403 Forbidden</title>
 </head>
 <body>
  <h1>403 Forbidden</h1>
 </body>
</html>
~ $ uname -a
Linux raspi-005 5.4.51-v7+ #1333 SMP Mon Aug 10 16:45:19 BST 2020 armv7l GNU/Linux
~ $

Should be the latest version of Buster-Light.

The working one has a index.lighttpd.html from the install:

$ find /var/www/ -ls
1445238    4 drwxr-xr-x   3 root     root         4096 Sep 20 08:31 /var/www/
1445260    4 drwxr-xr-x   2 root     root         4096 Sep 20 08:31 /var/www/html
1446160    4 -rw-r--r--   1 root     root         3373 Sep 20 08:31 /var/www/html/index.lighttpd.html

It was missing on the failing install. I copied it over checked and fixed permissions, owner and group. No Joy. I wrote a little html file into that directory and it seems to serve...
$ curl localhost:/foo.html
<H2> Hello World! </H2

Looks OK ... typo and all.

Here's the poop of the 2 Pis' OSs...

WORKING
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 8.0 (jessie)
Release:        8.0
Codename:       jessie
(Desktop version)

BROKEN
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 10 (buster)
Release:        10
Codename:       buster

Not clear why the copied index.lighttpd.html doesn't seem to work, while the little hack html file does?

I'm inclined to uninstall and re-install, but if there's useful information from the failed install I'd be happy to share whatever might be interesting.

Appreciate any help!

Just to double-check, here are the 2 html files side-by-side...

pi@raspi-005:~ $ find /var/www/ -ls
   257628      4 drwxr-xr-x   3 root     root         4096 Sep 20 08:37 /var/www/
   257629      4 drwxr-xr-x   2 root     root         4096 Sep 22 16:44 /var/www/html
   257697      4 -rw-r--r--   1 root     root           23 Sep 22 16:05 /var/www/html/foo.html
   257695      4 -rw-r--r--   1 root     root         3373 Sep 22 16:15 /var/www/html/index.lighttpd.html


Replies (3)

RE: New Raspberry Pi Install Yields 403 Forbidden at localhost - Added by gstrauss over 3 years ago

lighttpd works fine on Raspberry Pi when built from source.

This site is the official site for lighttpd. However, each Linux distro is responsible (or irresponsible) for packaging programs in their distro. The packages are intended to make it easier for people to install the software and hook it into startup scripts and the like. Please direct your question to Raspberry Pi forums (not lighttpd forums) and include the specific details of what you did for "I did 2 installs of lighttpd the other day on Raspberry Pis."

The official lighttpd source (on this site) does not contain "index.lighttpd.html" so please report that to the packagers for RPi.

Generic troubleshooting information:
  • Look in the error log for errors. For lighttpd, look in /etc/lighttpd/lighttpd.conf to see if server.errorlog is defined.
  • Look at the help for the program: lighttpd -h
    • To test lighttpd config: lighttpd -f /etc/lighttpd/lighttpd.conf -tt
    • To print lighttpd config: lighttpd -f /etc/lighttpd/lighttpd.conf -p

RE: New Raspberry Pi Install Yields 403 Forbidden at localhost - Added by radilly over 3 years ago

Thanks @gstrauss !

It may that building it is a better idea**. I hadn't really thought about the distro "owning" any issues, but given all the platforms out there, that division of labor makes sense. They should have the expertise to build (and test) on their target platform(s).

I need to collect my thoughts and report the issue. It's a little concerning that "index.lighttpd.html" is not part of the source, but at least it points to https://bugs.debian.org/cgi-bin/pkgreport.cgi?pkg=lighttpd to report bugs.

Thanks a lot!
Including the troubleshooting tips was very thoughtful!

- Bob

  • Unless there's a compelling reason, I try to keep my systems as close to "off the shelf" as I can. My goal is to be able to recreate a (formerly) working system easily, incorporating updates repeatably.

RE: New Raspberry Pi Install Yields 403 Forbidden at localhost - Added by gstrauss over 3 years ago

I misread your post before. The typo is in your own foo.html.

You haven't shared your lighttpd.conf (hint hint)
You made a request for /foo.html and it worked.
Did you make a request for /index.lighttpd.html ? Or did you only make a request for / ?
Did you check that mod_indexfile is loaded in server.modules and index-file.names is configured? Please see the mod_indexfile documentation.

    (1-3/3)