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,
- If the only section is Matomo's
Directory
section, then itsSetHandler
directive does its job. - If
/piwik/
doesn't have its ownLocation
, then theSetHandler
inside itsDirectory
section is not honored: this is as expected, sinceLocation
sections should have priority overDirectory
sections. - However, if
/piwik/
does have its ownLocation
, then itsSetHandler
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