@fskale opened this Issue on May 13th 2019

Version: 3.9.1
Webserver: apache2/nginx using php-fpm
When using php-fpm and not the native apache2 module, the FastCgi handler must point to an php file in the request uri.
However, the multisite plugin is broken, because the pwiki_url refers to / and therefore the fpm handler won't be triggered.
E.g.: nginx config snippet:

## only allow accessing the following php files
    location ~ ^/piwik/(index|matomo|piwik|js/index).php {
      include snippets/fastcgi-php.conf;
      fastcgi-php config replace this with the one from this repository
      fastcgi_param HTTP_PROXY "";
      fastcgi_pass unix:/var/run/php/piwik-fpm.sock; #replace with the path to your PHP socket file
    }

My Simple fix for that issue:

--- site.controller.js  2019-05-13 09:15:34.649259158 +0200
+++ site.controller.js.new  2019-05-13 09:11:18.251398270 +0200
@@ -41,7 +41,7 @@
                     break;
             }

-            return piwik.piwik_url + '?module=MultiSites&action=getEvolutionGraph&period=' + $scope.period + '&date=' + $scope.dateSparkline + '&evolutionBy=' + metric + '&columns=' + metric + '&idSite=' + website.idsite + '&idsite=' + website.idsite + '&viewDataTable=sparkline' + append + '&colors=' + encodeURIComponent(JSON.stringify(piwik.getSparklineColors()));
+            return piwik.piwik_url + 'index.php?module=MultiSites&action=getEvolutionGraph&period=' + $scope.period + '&date=' + $scope.dateSparkline + '&evolutionBy=' + metric + '&columns=' + metric + '&idSite=' + website.idsite + '&idsite=' + website.idsite + '&viewDataTable=sparkline' + append + '&colors=' + encodeURIComponent(JSON.stringify(piwik.getSparklineColors()));
         }
     }
 })();

Should i create a pull request ?
Thanks in advanced
Franz

@tsteur commented on May 13th 2019 Member

PR sounds good 👍

@fdellwing commented on May 13th 2019 Contributor

Just to make this clear, this is not a problem for everyone, it works perfectly fine for us.

This is our php-fpm snippet:

location ~ ^/(index|matomo|piwik).php {
    fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
    fastcgi_pass   unix:/var/run/php/php7.2-fpm.sock;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    fastcgi_param  HTTP_PROXY "";
    include        fastcgi_params;
}

Screenshot_20190513_094540

@Findus23 commented on May 13th 2019 Member

I also use Nginx with PHP-fpm (as explained in https://github.com/matomo-org/matomo-nginx) and it works for me. (As it expect ?= urls to work)

But the change also doesn't hurt, so it should be okay.

@fdellwing commented on May 13th 2019 Contributor

@Findus23 It seems like it works if index index.php index.html; or simply index index.php; is present in the server block. As this should always be the case in a clean configuration very little people should be affected by this.

But as you said, it does not hurt. So go for it.

@fskale commented on May 13th 2019

Hi,
thanks @fdellwing for the hint.
We use matomo in a subdir, so we configured the index to only be /site/index.php.
Adding index.php worked perfectly.
IMHO, a PR is not necessary anymore, or is it ?
Thanks for the superfast help !
Best regards
Franz

This Issue was closed on May 13th 2019
Powered by GitHub Issue Mirror