Mobile app version of vmapp.org
Login or Join
Harper822

: Piwik not recording visits on VPS server accessible through 1:1 NAT conversion I am in the process of migrating a Drupal 7 website which uses Piwik (v. 3.0.3) to monitor visits. There are some

@Harper822

Posted in: #Drupal #Matomo #Vps

I am in the process of migrating a Drupal 7 website which uses Piwik (v. 3.0.3) to monitor visits.

There are some differences between the two VPS servers, but nothing of consequence (Old server: Ubuntu 12.04 / MySQL 5.5.54 / PHP 5.5.37 --> New server: Ubuntu 16.04 / MySQL 5.7.17 / PHP 5.6.30 or 7.1). Everything works correctly on the new server, apart from Piwik not logging visits. Also, the piwik directory is owned by www-data and Apache's mod_secure module is not loaded.

Following an error of Drupal's Piwik module:


The validation of
"http://example.com/piwik/piwik.php" failed with error "Not Found"
(HTTP code 404). The validation of
"https://example.com/piwik/piwik.php" failed with error "Error opening
socket ssl://mysite.org:443" (HTTP code 0).


I tracked the problem down to the fact that the new server is accessible by 1:1 NAT conversion, with a 172.x.y.z local IP. Apparently, the VPS host has changed policies regarding IPv4 addresses without informing customers (as described here).

After I added 172.x.y.z to the Trusted Piwik Hostnames in Piwik's interface, the above error disappeared, but I can still get no logging of visits.

I am really stumped and would appreciate any help I can get. I am otherwise satisfied with my VPS host and would like to avoid the hassle of finding another one to migrate my site(s).

EDIT 1: Using the Firefox's Web Developer Network tab as proposed by TdotThomas, I find that piwik.js has a red square and gives headers:


Request URL: example.com/piwik/piwik.js
Request method: GET

Remote address: (the external IP)

Status code: 404 Not found

Version:HTTP/1.1


The piwik.js file itself IS accessible from the browser.

EDIT 2: On the piwik interface I change the Trusted Hostnames to 172.x.y.z/var/www/piwik and to example.com/piwik or example.com or example.com/piwik. Still nothing.
In Drupal's Piwik module (which provides each page with the appropriate Javascript code) I have entered all these variations.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Harper822

1 Comments

Sorted by latest first Latest Oldest Best

 

@Megan663

Make sure you use a FQDN while it should work with an IP address it has never worked in my experience.

Also make sure that you've added it to the website code correctly. I used firefox's developer network tab to see if it is fetching and loading correctly. You will see a green or red dot depending on if it loaded correctly or not.

Double check to make sure you have the paths set correctly in both piwik settings and the website tracker code.

Note:
172.x.y.z/path/to/piwik is not the same as example.com/path/to/piwik

Depending on your setup (sever OS and HTTP service) it might be something like 172.x.y.z/usr/home/www/path/to/piwik or something similar.

Last but now least check the permissions on the piwik folder.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme