Project

General

Profile

Lighttpd Userdir not working under Mint 21

Added by Claus 16 days ago

Hi
We published a Lighttpd installation instruction for a web programmers community and so far didn't have any issue with it for Linux Mint distros up to version 20.3 and Lighty up to V1.4.55. The instructions include the activation of mod_cgi, mod_fastcgi and mod_userdir. Me myself and somebody else are now facing the problem, that the userdir doesn't work on the new Mint 21 Vanessa. Firefox gets the response "404 Not Found". This applies for static HTML-pages as well as for CGI-scripts.

I found that somebody else with the same problem under Ubuntu Studio 22.04: https://redmine.lighttpd.net/boards/2/topics/10778
Unfortunately the thread is listed under "Solved", although the user was simply persuaded to use the standard directories which also work well on our platforms.

The installed version of Lighty under Mint 21 is 1.4.63. All enabled config files and a strace-file are attached.

The daemon status is the following:

 lighttpd.service - Lighttpd Daemon
     Loaded: loaded (/lib/systemd/system/lighttpd.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2023-01-11 17:04:10 CET; 22s ago
    Process: 754 ExecStartPre=/usr/sbin/lighttpd -tt -f /etc/lighttpd/lighttpd.conf (code=exited, status=0/SUCCESS)
   Main PID: 909 (lighttpd)
      Tasks: 6 (limit: 4560)
     Memory: 17.3M
        CPU: 334ms
     CGroup: /system.slice/lighttpd.service
             ├─909 /usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf
             ├─914 /usr/bin/php-cgi
             ├─916 /usr/bin/php-cgi
             ├─917 /usr/bin/php-cgi
             ├─918 /usr/bin/php-cgi
             └─919 /usr/bin/php-cgi

Jan 11 17:04:10 claus-VirtualBox systemd[1]: Starting Lighttpd Daemon...
Jan 11 17:04:10 claus-VirtualBox lighttpd[754]: 2023-01-11 17:04:10: (configfile.c.426) Warning: mod_auth should be listed in server.modules before dynamic backends such as mod_cgi
Jan 11 17:04:10 claus-VirtualBox lighttpd[754]: 2023-01-11 17:04:10: (configfile.c.426) Warning: mod_auth should be listed in server.modules before dynamic backends such as mod_fastcgi
Jan 11 17:04:10 claus-VirtualBox systemd[1]: Started Lighttpd Daemon.
Jan 11 17:04:11 claus-VirtualBox lighttpd[909]: 2023-01-11 17:04:10: (configfile.c.426) Warning: mod_auth should be listed in server.modules before dynamic backends such as mod_cgi
Jan 11 17:04:11 claus-VirtualBox lighttpd[909]: 2023-01-11 17:04:10: (configfile.c.426) Warning: mod_auth should be listed in server.modules before dynamic backends such as mod_fastcgi

The static html-page is called in Firefox with "http://localhost/~claus/test.html". The directory ~/public_html as well as test.html are owned by claus and its octal rights are 755. I noted that sudo apt install lighttpd under Mint 21 now also installs lightpd-mod-deflate and lighttpd-mod-openssl. A deinstallation of the latter didn't solve the problem.

These are the only modifications (from the standard) of all involved config files:
For /etc/lighttpd/lighttpd.conf:
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".py", ".cgi", ".gbs", ".gbw", ".gambas" )
For /etc/php/7.4/cli/php.ini:
cgi.fix_pathinfo=1

I hope that someone has an idea what causes the trouble.

My best wishes for 2023 and
with best regards
Claus


Replies (8)

RE: Lighttpd Userdir not working under Mint 21 - Added by gstrauss 16 days ago

If you have not done so already, check the lighttpd error log for clues. In your case server.errorlog = "/var/log/lighttpd/error.log"

In #3184, you were explicitly asked to read How to get support
You attaching 6 different .conf files here suggests that you should read How to get support more carefully. That page is not very long and contains explicit commands.

Your strace does not appear to contain a failing HTTP request to a userdir.
While you strace lighttpd, send a request with Firefox to "http://localhost/~claus/test.html"

The strace suggests that you are using mod_openssl -- not shared in piecemeal your config above -- as the requests appears encrypted. mod_authn_pam might be in use as well, given what I see in the strace. The first request after accept4 in the strace appears to be handled by header.cgi. You appear to have stopped the strace during the second request after accept4. (And you appear to have given a portion of strace log which was in the middle of handling pdd_web_nms.cgi.)

When asking for help from others, please follow directions and try really, really hard to provide useful information and not waste everyone's time.

RE: Lighttpd Userdir not working under Mint 21 - Added by Claus 16 days ago

No errors in /var/log/lighttpd/error.log.
Your instructions for strace (https://redmine.lighttpd.net/projects/1/wiki/HowToReportABug)
a) don't work as described - at least on my Mint 21 and
b) there are no instructions about how to use it properly.
Request like "http://localhost/~claus/test.html" apparently don't leave any event in strace for reasons I don't know - possibly a wrong handling or wrong instructions. I am not the inventor of strace.
I further "explicitly" read "How to get support" - did you? I provided far more information than listed there. Sorry that I wasted your time. I hope that this is not the case for "everyone", and would be pleased if there is somebody left who has patience with a simple lighttpd user asking for help. If this is not your level in this forum feel free to kick me out.
Claus

RE: Lighttpd Userdir not working under Mint 21 - Added by gstrauss 16 days ago

You've been asked multiple times to provide the output of the commands in How to get support
You have failed to do so and you have failed to recognize that you have failed to do so. Multiple times.
If you are unable to run lighttpd -p then you will get no further response from me here, as you are too helpless to be assisted.

Request like "http://localhost/~claus/test.html" apparently don't leave any event in strace for reasons I don't know

It might mean that those requests are not reaching the lighttpd process on which you are running strace

RE: Lighttpd Userdir not working under Mint 21 - Added by Claus 16 days ago

The output of lighttpd -tt -f /etc/lighttpd/lighttpd.conf is:

$ lighttpd -tt -f /etc/lighttpd/lighttpd.conf
2023-01-12 21:32:43: (configfile.c.426) Warning: mod_auth should be listed in server.modules before dynamic backends such as mod_cgi
2023-01-12 21:32:43: (configfile.c.426) Warning: mod_auth should be listed in server.modules before dynamic backends such as mod_fastcgi
2023-01-12 21:32:43: (configfile.c.2567) server.upload-dirs doesn't exist: /var/cache/lighttpd/uploads

The output of lighttpd -p -f /etc/lighttpd/lighttpd.conf is attached as file.

I further managed to get strace running with lighttpd with following result regarding the localhost/~claus/test.html request (the complete trace-file is attached):

21:20:19.916004 close(11)               = 0
21:20:19.916066 newfstatat(AT_FDCWD, "/home/claus/public_html", 0x7ffffeae9d20, 0) = -1 EACCES (Keine Berechtigung)
21:20:19.916133 newfstatat(AT_FDCWD, "/var/www/html/~claus/test.html", 0x7ffffeae9eb0, 0) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
21:20:19.916206 writev(10, [{iov_base="HTTP/1.1 404 Not Found\r\nContent-Type: text/html\r\nContent-Length: 341\r\nDate: Thu, 12 Jan 2023 20:20:19 GMT\r\nServer: lighttpd/1.4.63\r\n\r\n", iov_len=134}, {iov_base="<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n         \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n <head>\n  <title>404 Not Found</title>\n </head>\n <body>\n  <h1>404 Not Found</h1>\n </body>\n</html>\n", iov_len=341}], 2) = 475
21:20:19.916288 read(10, 0x563b4ed04080, 8192) = -1 EAGAIN (Die Ressource ist zur Zeit nicht verfügbar)
21:20:19.916336 epoll_wait(7, [], 1025, 1000) = 0
21:20:20.917769 epoll_wait(7, [], 1025, 1000) = 0

Claus

RE: Lighttpd Userdir not working under Mint 21 - Added by gstrauss 16 days ago

You should probably fix those warnings from lighttpd -tt, which was the advice also given to you in #3184.
Do you see a pattern of you asking for help, and then ignoring the advice given? I do.

21:20:19.916066 newfstatat(AT_FDCWD, "/home/claus/public_html", 0x7ffffeae9d20, 0) = -1 EACCES (Keine Berechtigung)

EACCES means that the lighttpd process does not have access. In your config, lighttpd is running as user "www-data", and that user does not have access to "/home/claus/public_html". This is similar to the issue in https://redmine.lighttpd.net/boards/2/topics/10778 and the advice is the same: if you have had this much hassle troubleshooting and identifying a permission error -- a problem with your system and not a bug in lighttpd -- perhaps configuring mod_userdir to use paths under home directories is not the best solution for you. One alternative option is that lighttpd mod_userdir allows you to specify an alternate location to use instead of home dirs, e.g. userdir.basepath = "/var/www/users/"

You can also look at stackoverflow, where the issue of directory permissions to get mod_userdir working has been discussed many times.
This is not an issue in lighttpd. It is a misconfiguration of (your intended) permissions on your system.

RE: Lighttpd Userdir not working under Mint 21 - Added by Claus 15 days ago

You should probably fix those warnings from lighttpd -tt, which was the advice also given to you in #3184.

These are „should“ warnings and not a „must“ warnings. I also don‘t need authentication and the inclusion of mod_auth was also not required under Mint 20.3. I ignored your advice knowingly, because I had the same problem before I activated mod_cgi, and mod_fastcgi.

Do you see a pattern of you asking for help, and then ignoring the advice given?

I had a reason as described above. The deactivation of fastcgi and cgi removed the warnings but the userdir still doesn‘t work - as expected.

EACCES means that the lighttpd process does not have access. In your config, lighttpd is running as user "www-data", and that user does not have access to "/home/claus/public_html".

Yes indeed, and it would be helpful to know why. I informed you about the ownership and access-rights of my directories and the static html-file.

This is similar to the issue in https://redmine.lighttpd.net/boards/2/topics/10778 and the advice is the same: if you have had this much hassle troubleshooting and identifying a permission error -- a problem with your system and not a bug in lighttpd -- perhaps configuring mod_userdir to use paths under home directories is not the best solution for you. One alternative option is that lighttpd mod_userdir allows you to specify an alternate location to use instead of home dirs, e.g. userdir.basepath = "/var/www/users/"

This is not a solution for for me and raises the question, why mod_userdir is provided with Lighttpd and with a default conf entry for the userdir.path. Everyone should expect this to work out of the box, if the owner and user right are set correctly – and they are.

You can also look at stackoverflow, where the issue of directory permissions to get mod_userdir working has been discussed many times.

I read it. It is also related to Apache and not Lighttpd and it doesn‘t provide a solution. I know what user rights and ownerships are required and I provided according references.

This is not an issue in lighttpd. It is a misconfiguration of (your intended) permissions on your system.

I would be grateful if somebody else can help me to come to the same - but fact-based - conviction.

Best regards
Claus

RE: Lighttpd Userdir not working under Mint 21 - Added by gstrauss 15 days ago

I would be grateful if somebody else can help me to come to the same - but fact-based - conviction.

Asked and answered. EACCES is a permissions issue.

This is not an issue with lighttpd.

You continue to look like fool demanding "it should work" after you have been told your system is not configured how you think it is configured.

This is not an issue with lighttpd.

This is not an issue with lighttpd.

This is not an issue with lighttpd.

Hi. You're on a lighttpd support site. What you have described is not an issue with lighttpd. Your issue is a permission issue on your system.

Learn how to troubleshoot permissions errors on your Mint system or ask for help configuring Mint in a Mint forum. Maybe your SELinux configuration?

This is not an issue with lighttpd.

Did you get the hint yet?

    (1-8/8)