0

I have Apache 2.4 working with php7 using php-fpm. I'm using this block to pass traffic to php-fpm

<FilesMatch "\.php$">
    SetHandler "proxy:fcgi://127.0.0.1:9000"
</FilesMatch>

The problem I'm having is that parts of the application I'm using, piwik, create php images with urls like this

https://xxxxx.edu/piwik/?module=MultiSites&action=getEvolutionGraph&period=day&date=2017-01-28,2017-02-26&evolutionBy=nb_visits&columns=nb_visits&idSite=57&idsite=57&viewDataTable=sparkline&colors=%7B%22backgroundColor%22%3A%22%23ffffff%22%2C%22lineColor%22%3A%22%23162c4a%22%2C%22minPointColor%22%3A%22%23ff7f7f%22%2C%22maxPointColor%22%3A%22%2375bf7c%22%2C%22lastPointColor%22%3A%22%2355aaff%22%7D

because there is no .php in the url the FilesMatch fails. If I manually change the url to something like https://xxxxx.edu/piwik/index.php?module= it works fine...

So I'm thinking that either changing the FilesMatch to catch module= or creating a rewrite rule to insert index.php would work but I could use some help doing either.

buffcleb
  • 1
  • 1
  • Unfortunately I don't know how to do it exactly in Apache, but you need to declare `index.php` as the directory index file in the Apache configuration. This way all requests where the path component of the URL ends up with `/` will be passed to `index.php` at the corresponding path. – Tero Kilkanen Feb 28 '17 at 14:18
  • Thank you Tero - That was just enough to help me figure it out... I modified the .htaccess file in the root adding `DirectoryIndex index.php` and added `AllowOverride Indexes` to the httpd.conf. – buffcleb Feb 28 '17 at 14:32

1 Answers1

0

Based on Tero's response I found that I could make two changes that fixed things:

add Indexes to the AllowOverride for the directory in the VirtualHost settings

add DirectoryIndex index.php to the .htaccess file in the root of that directory.

not sure if its the best solution but it does work.

buffcleb
  • 1
  • 1
  • AllowOverride and .htaccess are a solution for nothing, just a functionality to give non-admin permissions over config in certain directories. You probably just need `FallBackResource /index.php` – Daniel Ferradal Mar 03 '17 at 01:55