Does Piwik have to be run from a seperate server and domain?

I’m running a personal blog, call it my-blog and I decided that I’d like to look at some analytics so I’d play with piwik. As I don’t want the expense of running it on a new server, I decided that I’d just run it on the server which is serving the blog. I mean it’s not like my server is busy and Nginx can cope with different domains and the like.

So I decided that I’d serve piwik from my-blog:81 and track visits to my-blog, which is on port 80. In my head that doesn’t seem to present any problems. And on nginx access log when I point the browser at the blog site on port 80 I can see access to the piwik install. However when I go and look at the piwik install it says that there’s no data?

Is Piwik confused by port numbers or am I?

nginx access is giving me:

“GET /piwik.php?action_name=-%20my-blog&idsite=1&rec=1&r=067924&h=10&m=32&s=25& HTTP/1.1” 200 54 “” “Mozilla/5.0 (X11; Linux x86_64; rv:48.0) Gecko/20100101 Firefox/48.0”

So the script is in the page and working. So what is the error here is it my configuration of trusted hosts or something?

trusted_hosts[] = “”,

In my head that trusted_hosts looks wrong. I don’t know how you would use port numbers though.

That config of trusted_hosts was what piwik told me to put in when I first logged in. I’m going to try delete everything yet again and try on another domain What I have done is by the book. The java script seems to be run as it’s showing up in the nginx log. the php5 logs seem to be happy and aren’t giving me errors, but piwik is a black box with no indication of what it’s doing or what it thinks it’s doing. Must look for its log files to see what it thinks it’s doing.

Really? It added the port like that? My installation didn’t do that and I use port 80, 81, 82 and 83 on my Apache server. I can’t comment on nginx as I’ve never really used it (Tried once but couldn’t figure out the config). I’v been using Apache for 30 years so I know most of it backwards.

I’ve been playing around with the code in Piwik to see what it does (Adding fwrite code to see what the actual data is). You may want to try the same. There may be a bug.

finally found some indication of the error. I installed following the instructions:

I’m using MariaDB and that’s causing me problems. I’ll have to look into this.

INFILE will greatly speed Piwik’s archiving process up. To make it
available to Piwik, try updating your PHP & MySQL software and make
sure your database user has the FILE privilege.
If your Piwik server tracks high traffic websites (eg. > 100,000 pages per month), we recommend to try fix this problem.
Error: LOAD DATA INFILE failed… Error was:

Try #1: LOAD DATA INFILE : SQLSTATE[28000]: Invalid authorization
specification: 1045 Access denied for user ‘piwikuser’@’%’ (using
password: YES)[28000],
SQLSTATE[42000]: Syntax error or access violation: 1148 The used command
is not allowed with this MariaDB version[42000]
Troubleshooting: FAQ on

Forget that as the top of the System Check page says:

There are some issues with your system. Piwik will run, but you might experience some minor problems.

That says that Piwik should be working, but it ain’t, and there’s no indication why in, any sort of log file as to a reason why. I could move to mysql but given that I’m running MariaDB and it THINKS that it is working I’m not sure it’ll work any better on mysql.

The most obvious reason for site visits not being logged is that the Javascript isn’t running but as I can see that nginx access logs and see each post as far as I can see the Javascript is running and php5 is running without any issues. The piwik web site is being displayed properly it just don’t log site traffic.

Time to move on

May I ask what you are moving to?

Sorry been having Internet issues all week. What am I moving to? Good question. I’d hate to say google analytics, but what else is there? If I had a clue about PHP programming I might get into this to see what the issue is but even if I had a clue there’s very little activity on here.

Given my lack of PHP the only thing I could do to help is document my install procedure, spin up a clean server on Digital Ocean and go through each step and post that here on the forum, to see if somebody sees an issue, but I get the feeling that the effort would yield little in terms of results as there ain’t much going on here.

Maybe it’d be worth trying with mysql instead of MariaDB. I’ll think about it

Clean Virtual Server on DigitalOcean and another total fail with mysql. Surprisingly it didn’t even get as far as MariaDB did.

Burned the server, nothing to see here.

Weird. I guess my server is local and I run the Piwik installation on the same server as the web server. Yhe MySQL DB is on a different server on the same sub net. It works perfectly.

I really don’t understand why your doesn’t unless there’s something strange about Digital Ocean. I’m guessing you followed the Tutorial?

BTW. I can’t use Google as this is intranet only and any external access is blocked.

Can I just say that the Piwik install instructions at [1] jump straight to configuration of the INSTALLED Piwik web site. You’ve a bit of a way to go before you get to that step. Digital Ocean’s instructions for an older version of Ubuntu do the same thing the install instructions are a simple unzipping of the piwik zip file and point the browser at the target.

I’ve tried again and documented each step. It’s the configuration of nginx and its link to php which I just can’t seem to get. Here’s what I’m doing

[1] Installing Piwik - Analytics Platform - Piwik

So, Ubuntu is just your standard linux distro and is fairly simple. I’ve tried setting up nginx and found it’s too hard (for me). I’ve had a lot of experience with Apache so that’s what I always use. PHP7 is bleeding edge so, for the time, being i’ll stick with PHP5.

I would recommend setting up a LAMP server. That is what I know and can help you the most with.

Thanks a million for all your time here. I’m starting to think that piwik’s “documentation” is more of a hindrance then a help. Any search phrase that I try on the Web is just throwing me back the page:
That page is sabotaging everything and it gives no useful information.
So apart from that rant I’ve burned the server and restarted but this time with apache2 I’m trying a file in sites-enabled like the one below but apache2 won’t even start with it in place. Worse then that it’s not giving me a reason why it can’t start. Now I can’t find a good configuration file for piwik given its pollution of the Web search space. Is there anything obvious wrong with this file:

<VirtualHost :80>

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/piwik
    ServerName <IP Address>:80

    ErrorLog ${APACHE_LOG_DIR}/piwik-error.log
    CustomLog ${APACHE_LOG_DIR}/piwik-access.log combined

    <Directory /var/www/piwik>

        Order allow,deny
        Allow from all
        AllowOverride None
        Options Indexes FollowSymLinks

        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule .* index.php [L,QSA]


Things to try:
VirtualHost *:80. ie. add the *
Remove the :80 from the ServerName Directive. Normally the 80 would go in a Listen directive. I’ve never seen it in a ServerName directive
Set the log directives to a static path. eg. /var/log/piwik-error.log
Comment out the Rewrite stuff

Apache should start.

Thanks for that I’ve got Apach2 up and running but I’m missing something in the PHP Dept. I’m getting a blank page when I surf to the server. There are no error messages and just a log of the access but a 304 response. I assume that the request is not getting passed on to PHP, still looking into it