-
Notifications
You must be signed in to change notification settings - Fork 75
Piwik
There are two primary installation choices:
- a root, barracuda-level install --
/var/www/piwik
- a user, octopus-level install --
/data/disk/o1/static/piwik
Notes:
- The sample nginx vhost force HTTPS only. Piwik does not like self-signed certificates so you'll either need a valid certificate (replace wildcard crt and key with your own) and dedicated IP (replace *:80 and *:443 with YO.UR.EXTRA.IP1:80 and YO.UR.EXTRA.IP1:443, respectively) or can use something like Cloudflare to get a free SSL certificate. Alternatively, you can remove the
rewrite ^ https://$host$request_uri? permanent;
rule and allow HTTP traffic. This will require some additional nginx vhost config, but most of this can just be reused from the 443 section (ie, fastcgi_param, limit_conn, root, index, and include). - The sample nginx vhost also assumes you have installed SPDY Nginx support via
_NGINX_SPDY=YES
. If you do not have SPDY, simply removespdy
from the example nginx vhost listen directive. - The sample nginx vhost leverages an existing BOA include file. You may wish to create your own instead. https://github.com/perusio/piwik-nginx has a useful set of example configuration files for Nginx and Piwik.
- You can see the original issue and discussion about Piwik under BOA here: https://github.com/omega8cc/boa/issues/531
A. Create Piwik database and user (replace r7Mp2c77 with desired password):
CREATE DATABASE `piwik` /*!40100 COLLATE 'utf8_general_ci' */;
CREATE USER 'piwik'@'localhost' IDENTIFIED BY 'r7Mp2c77';
GRANT USAGE ON *.* TO 'piwik'@'localhost';
GRANT SELECT, EXECUTE, SHOW VIEW, ALTER, ALTER ROUTINE, CREATE, CREATE ROUTINE, CREATE TEMPORARY TABLES, CREATE VIEW, DELETE, DROP, EVENT, INDEX, INSERT, REFERENCES, TRIGGER, UPDATE, LOCK TABLES ON `piwik`.* TO 'piwik'@'localhost';
CREATE USER 'piwik'@'127.0.0.1' IDENTIFIED BY 'r7Mp2c77';
GRANT USAGE ON *.* TO 'piwik'@'127.0.0.1';
GRANT EXECUTE, SELECT, SHOW VIEW, ALTER, ALTER ROUTINE, CREATE, CREATE ROUTINE, CREATE TEMPORARY TABLES, CREATE VIEW, DELETE, DROP, EVENT, INDEX, INSERT, REFERENCES, TRIGGER, UPDATE, LOCK TABLES ON `piwik`.* TO 'piwik'@'127.0.0.1';
FLUSH PRIVILEGES;
B. Download Piwik
$ cd /var/www/
$ wget http://builds.piwik.org/piwik.zip
$ extract piwik.zip
$ rm -rf piwik.zip "How to install Piwik.html"
Note the php version utilized by your master Aegir instance, chive, and cgp. If PHP 5.5, then use www55 in the next step. For PHP 5.3, use www53 and so on.
$ chown -R www55:www-data /var/www/piwik
C. Create Nginx vhost at /var/aegir/config/server_master/nginx/vhost.d/piwik.example.com
###
### Piwik Web Analytics Redirect to HTTPS.
###
server {
listen *:80;
server_name piwik.example.com;
rewrite ^ https://$host$request_uri? permanent;
}
###
### Piwik Web Analytics HTTPS Only.
###
server {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS on;
limit_conn limreq 555;
### access live
listen *:443 ssl spdy;
server_name piwik.example.com;
root /var/www/piwik;
index index.php index.html;
ssl on;
ssl_certificate /etc/ssl/private/nginx-wild-ssl.crt;
ssl_certificate_key /etc/ssl/private/nginx-wild-ssl.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH:EDH+aRSA:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!RC4;
ssl_prefer_server_ciphers on;
keepalive_timeout 70;
if ($is_crawler) {
return 403;
}
include /var/aegir/config/includes/nginx_compact_include.conf;
}
D. Restart Nginx with service nginx reload
or service nginx restart
. Done!
E. Browse to piwik.example.com and complete The 5-minute Piwik Installation
A. Create Piwik database and user (replace r7Mp2c77 with desired password):
CREATE DATABASE `piwik` /*!40100 COLLATE 'utf8_general_ci' */;
CREATE USER 'piwik'@'localhost' IDENTIFIED BY 'r7Mp2c77';
GRANT USAGE ON *.* TO 'piwik'@'localhost';
GRANT SELECT, EXECUTE, SHOW VIEW, ALTER, ALTER ROUTINE, CREATE, CREATE ROUTINE, CREATE TEMPORARY TABLES, CREATE VIEW, DELETE, DROP, EVENT, INDEX, INSERT, REFERENCES, TRIGGER, UPDATE, LOCK TABLES ON `piwik`.* TO 'piwik'@'localhost';
CREATE USER 'piwik'@'127.0.0.1' IDENTIFIED BY 'r7Mp2c77';
GRANT USAGE ON *.* TO 'piwik'@'127.0.0.1';
GRANT EXECUTE, SELECT, SHOW VIEW, ALTER, ALTER ROUTINE, CREATE, CREATE ROUTINE, CREATE TEMPORARY TABLES, CREATE VIEW, DELETE, DROP, EVENT, INDEX, INSERT, REFERENCES, TRIGGER, UPDATE, LOCK TABLES ON `piwik`.* TO 'piwik'@'127.0.0.1';
FLUSH PRIVILEGES;
B. Download Piwik
$ cd /data/disk/o1/static
$ wget http://builds.piwik.org/piwik.zip
$ extract piwik.zip
$ rm -rf piwik.zip "How to install Piwik.html"
Note the php version utilized by your octopus Aegir instance and Drupal sites. If PHP 5.5, then use www55 in the next step. For PHP 5.3, use www53 and so on.
$ chown -R www55:www-data /data/disk/o1/static/piwik
C. Create Nginx vhost at /var/aegir/config/server_master/nginx/vhost.d/piwik.example.com
###
### Piwik Web Analytics Redirect to HTTPS.
###
server {
listen *:80;
server_name piwik.example.com;
rewrite ^ https://$host$request_uri? permanent;
}
###
### Piwik Web Analytics HTTPS Only.
###
server {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS on;
limit_conn limreq 555;
### access live
listen *:443 ssl spdy;
server_name piwik.example.com;
root /data/disk/o1/static/piwik;
index index.php index.html;
ssl on;
ssl_certificate /etc/ssl/private/nginx-wild-ssl.crt;
ssl_certificate_key /etc/ssl/private/nginx-wild-ssl.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH:EDH+aRSA:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!RC4;
ssl_prefer_server_ciphers on;
keepalive_timeout 70;
if ($is_crawler) {
return 403;
}
include /data/disk/o1/config/includes/nginx_compact_include.conf;
}
D. Restart Nginx with service nginx reload
or service nginx restart
. Done!
E. Browse to piwik.example.com and complete The 5-minute Piwik Installation
Piwik can display location information using GeoIP. In order enable it one must add these lines:
fastcgi_param GEOIP_ADDR $remote_addr;
fastcgi_param GEOIP_COUNTRY_CODE $geoip_country_code;
fastcgi_param GEOIP_COUNTRY_NAME $geoip_country_name;
fastcgi_param GEOIP_REGION $geoip_region;
fastcgi_param GEOIP_REGION_NAME $geoip_region_name;
fastcgi_param GEOIP_CITY $geoip_city;
fastcgi_param GEOIP_AREA_CODE $geoip_area_code;
fastcgi_param GEOIP_LATITUDE $geoip_latitude;
fastcgi_param GEOIP_LONGITUDE $geoip_longitude;
fastcgi_param GEOIP_POSTAL_CODE $geoip_postal_code;
fastcgi_param GEOIP_ORGANIZATION $geoip_org;
to the vhosts file (both on plain and SSL directives). Then, in Piwik's administration the GeoIP (HTTP Server Module) option should be available for selection.