Piwik
Piwik is a real-time web analytics application.
This module configures php-fpm as backend for piwik, optionally configuring an nginx vhost as well.
An automatic setup is not suported by piwik, so you need to configure piwik itself in the browser-based piwik setup.
Database Setup
You also need to configure a MariaDB or MySQL database and -user for piwik yourself,
and enter those credentials in your browser.
You can use passwordless database authentication via the UNIX_SOCKET authentication plugin
with the following SQL commands:
# For MariaDB
INSTALL PLUGIN unix_socket SONAME 'auth_socket';
CREATE DATABASE piwik;
CREATE USER 'piwik'@'localhost' IDENTIFIED WITH unix_socket;
GRANT ALL PRIVILEGES ON piwik.* TO 'piwik'@'localhost';
# For MySQL
INSTALL PLUGIN auth_socket SONAME 'auth_socket.so';
CREATE DATABASE piwik;
CREATE USER 'piwik'@'localhost' IDENTIFIED WITH auth_socket;
GRANT ALL PRIVILEGES ON piwik.* TO 'piwik'@'localhost';
Then fill in piwik as database user and database name, and leave the password field blank.
This authentication works by allowing only the piwik unix user to authenticate as the
piwik database user (without needing a password), but no other users.
For more information on passwordless login, see
.
Of course, you can use password based authentication as well, e.g. when the database is not on the same host.
Backup
You only need to take backups of your MySQL database and the
/var/lib/piwik/config/config.ini.php file.
Use a user in the piwik group or root to access the file.
For more information, see .
Issues
Piwik's file integrity check will warn you.
This is due to the patches necessary for NixOS, you can safely ignore this.
Piwik will warn you that the JavaScript tracker is not writable.
This is because it's located in the read-only nix store.
You can safely ignore this, unless you need a plugin that needs JavaScript tracker access.
Using other Web Servers than nginx
You can use other web servers by forwarding calls for index.php and
piwik.php to the /run/phpfpm-piwik.sock fastcgi unix socket.
You can use the nginx configuration in the module code as a reference to what else should be configured.