Fixed it,
For some reason the following file’s AllowOverride All (the thing that makes htaccess files work) is being ignored. I’m not sure the reason.
root@nextcloud:/etc/apache2/sites-available# cat nextcloud.conf
Alias /nextcloud "/var/www/nextcloud/"
<Directory /var/www/nextcloud/>
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
<IfModule mod_dav.c>
Dav off
</IfModule>
</Directory>
I edited the following file: /etc/apache2/apache2.conf
I changed this block:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
to say
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
I’m not finding any good info in my searches about why this is. Is nextcloud.conf just not being read at all? Does an AllowOverride in a higher directory preclude subdirectories from working? Many questions. Anyway, I’ve got it working, it seems to possibly been an apache update as the culprit:
https://httpd.apache.org/docs/current/mod/core.html#allowoverride
But who knows, it definitely wasn’t there one day, and after an upgrade, boom!
Better fix below
Somewhere along the way nextcloud.conf inside sites-enabled was removed either from the apache.conf or list of sites for apache, this is why the AllowOverrides was being ignored.
So I ran the following command to get Apache to use the nextcloud.conf located: /etc/apache2/sites-enabled/nextcloud.conf
a2ensite nextcloud.conf
This file looks like the following (in case you don’t want to scroll up)
root@nextcloud:/etc/apache2/sites-enabled# cat nextcloud.conf
Alias /nextcloud "/var/www/nextcloud/"
<Directory /var/www/nextcloud/>
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
<IfModule mod_dav.c>
Dav off
</IfModule>
</Directory>
Once complete, I undid the change I did in my previous post and set the following block in /etc/apache2/apache.conf to AllowOverrides None
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
Theory of least privilege and all.
Rebooted apache with a systemctl reload apache2
and boom, my htaccess file in /var/www/nextcloud is working still.
and no more error! Besides the “you do not have an email server”, like yah, no duh, who wants to deal with that noise!
Cheers!