AuthType Basic and htpasswd

Bug Report Template

This could very much be user error here, but I’m missing something obvious. I’m trying to configure Basic Auth for a static HTML site, and Apache can’t seem to find an .htpasswd file where I believe it should. There’s a single reference to using htpasswd for WebDAV in the docs, so I’ve followed the convention there.

Description

Apache cannot find/read /var/www/.htpasswd. Even moving the .htpasswd file to /var/www/html, does not work.

Steps to Reproduce

An .htaccess directive with AuthType Basic, referring to a

AuthType Basic
AuthName "Access to site"
AuthUserFile /var/www/.htpasswd
Require user xxx

/var/www/.htpasswd exists, with permissions 644 owned by siteuser:siteuser:

ls -al /var/www
-rw-r--r-- 1 siteuser siteuser 47 Aug  1 03:26 .htpasswd

Apache borks with
(2)No such file or directory: [remote 192.168.2.70:5329] AH01620: Could not open password file: /var/www/.htpasswd

Expected Behavior

htpasswd file to be found and read by Apache

Actual Behavior

http/500 returned

Environment

ApisCP version:
revision: 74b0e2ca2bb80b7a30fab4546ac1948c875549f3
timestamp: 1785256541
ver_maj: 3
ver_min: 2
ver_patch: 48
ver_pre: 79-g74b0e2ca2
dirty: false
checksum: 13527c178b459e9
debug: false

Operating System:
4.18.0-553.137.1.el8_10.x86_64

Answering my own bug report here and feeding the algorithm.

For whatever reason, the path used to refer to the htpasswd file should be that of the non-virtual filesystem:

Does not work:

AuthUserFile "/var/www/.htpasswd"

Works:

AuthUserFile "/home/virtual/site6/fst/var/www/.htpasswd"