TransWikia.com

Multiple "Location" sections with different handlers aren't combined anymore in apache2 after upgrade

Server Fault Asked by Pietro Battiston on November 24, 2021

I have a website with the following configuration:

<VirtualHost *:80>
    ServerName example.it

<Location />
    SetHandler uwsgi-handler
    uWSGISocket /var/sitedir/moin.sock
</Location>

<Location /piwik/>
    SetHandler application/x-httpd-php
</Location>

<Directory "/var/piwik/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Require all granted
    SetHandler application/x-httpd-php
</Directory>

Alias /piwik/ "/var/piwik/"

</VirtualHost>

… including a moinmoin wiki and a Matomo instance; but since some system upgrade, when I visit http://example.it/piwik, I get the source of the index.php file inside /var/piwik/ – it is not executed.

I know this suggests of some php problem – but if I remove the two Location sections, Matomo works just fine at http://example.it/piwik (Moinmoin clearly stops working). So it is really a problem of this configuration.
If instead I only remove the second Location section (Matomo’s one), then http://example.it/piwik is served by uwsgi (Moinmoin).

So summing up,

  1. If the only section is Matomo’s Directory section, then its SetHandler directive does its job.
  2. If /piwik/ doesn’t have its own Location, then the SetHandler inside its Directory section is not honored: this is as expected, since Location sections should have priority over Directory sections.
  3. However, if /piwik/ does have its own Location, then its SetHandler statement should be honored, because it comes later. And in fact, something happens, because the request is not served by uwsgi. But it’s not served as php either.

What is going wrong? Notice that I’m sure Moinmoin and Matomo worked both fine before a system upgrade, and while I’m not sure anymore how exactly the config file was, I’m pretty sure I tried all the combinations including the one that used to work.

EDIT: related, but does not explain my problem: How does Apache merge multiple matching Location sections

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP