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.

  • 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
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.

  • 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 – ezra-s Mar 3 '17 at 1:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.