Changes between Version 21 and Version 22 of PiwikServer


Ignore:
Timestamp:
06/29/11 19:36:40 (5 years ago)
Author:
chris
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • PiwikServer

    v21 v22  
    44This page is to document the [http://piwik.org/ Piwik] server that is to be installed on the DevelopmentServer, the install was done on ticket:160 
    55 
     6== Live Server == 
     7 
     8=== Install === 
     9 
     10{{{ 
     11cd /web 
     12cd stats.transitionnetwork.org/ 
     13wget http://piwik.org/latest.zip 
     14unzip latest.zip 
     15cd piwik 
     16chown -R www-data:www-data tmp/ 
     17chown -R www-data:www-data config/ 
     18chown -R www-data:www-data themes/ 
     19}}} 
     20 
     21=== Apache === 
     22 
     23Create {{{stats.transitionnetwork.org.conf}}} in {{{cd /etc/apache2/sites-available/}}}: 
     24 
     25{{{ 
     26<VirtualHost *:80> 
     27  ServerName stats.transitionnetwork.org 
     28  ServerAlias stats.transitionnetwork.org.webarch.net 
     29  ServerSignature Off 
     30  UseCanonicalName On 
     31 
     32  ErrorLog /var/log/apache2/stats.transitionnetwork.org_error.log 
     33  ErrorLog /var/log/apache2/error.log 
     34  SetEnvIf Remote_Addr "127\.0\.0\.1" loopback 
     35  SetEnvIf Remote_Addr "kiwi\.transitionnetwork\.org" loopback 
     36  CustomLog /var/log/apache2/stats.transitionnetwork.org_access.log combined env=!loopback 
     37  CustomLog /var/log/apache2/access.log combined env=!loopback 
     38 
     39  Redirect / https://stats.transitionnetwork.org/ 
     40</VirtualHost> 
     41 
     42<VirtualHost *:443> 
     43  ServerName stats.transitionnetwork.org 
     44  ServerAlias stats.transitionnetwork.org.webarch.net 
     45  ServerSignature Off 
     46  UseCanonicalName On 
     47 
     48  LogLevel warn 
     49  ErrorLog /var/log/apache2/stats.transitionnetwork.org_ssl_error.log 
     50  ErrorLog /var/log/apache2/error.log 
     51  SetEnvIf Remote_Addr "127\.0\.0\.1" loopback 
     52  SetEnvIf Remote_Addr "kiwi\.transitionnetwork\.org" loopback 
     53  CustomLog /var/log/apache2/stats.transitionnetwork.org_ssl_access.log combined env=!loopback 
     54  CustomLog /var/log/apache2/access.log combined env=!loopback 
     55 
     56  SSLEngine on 
     57  SSLCipherSuite HIGH 
     58  SSLProtocol all -SSLv2 
     59  SSLCertificateFile      /etc/ssl/transitionnetwork.org/transitionnetwork.org.pem 
     60  SSLCertificateChainFile /etc/ssl/transitionnetwork.org/gandi.pem 
     61 
     62  DocumentRoot "/web/stats.transitionnetwork.org/piwik" 
     63  <Directory "/web/stats.transitionnetwork.org/piwik"> 
     64    DirectoryIndex index.php 
     65    Options -Indexes 
     66    AddType 'image/x-icon' .ico 
     67    AddHandler php5-script .php 
     68    AddType text/html .php 
     69    SSLOptions +StdEnvVars 
     70    AllowOverride None 
     71    order allow,deny 
     72    allow from all 
     73  </Directory> 
     74  <Directory "/web/stats.transitionnetwork.org/piwik/tmp"> 
     75    Options Indexes 
     76    RemoveHandler .php 
     77    AllowOverride None 
     78    order allow,deny 
     79    allow from all 
     80  </Directory> 
     81  <Location /config> 
     82    Order deny,allow 
     83    Deny from all 
     84    Allow from 127.0.0.1 
     85  </Location> 
     86 
     87  <FilesMatch "\.(cgi|shtml|phtml|php)$"> 
     88    SSLOptions +StdEnvVars 
     89  </FilesMatch> 
     90  <Directory /usr/lib/cgi-bin> 
     91    SSLOptions +StdEnvVars 
     92  </Directory> 
     93 
     94</VirtualHost> 
     95}}} 
     96 
     97Enable it and restart: 
     98 
     99{{{ 
     100/etc/apache2/sites-enabled 
     101ln -s ../sites-available/stats.transitionnetwork.org.conf 35-stats.transitionnetwork.org.conf 
     102apache2ctl configtest 
     103apache2ctl restart 
     104}}} 
     105 
     106=== MySQL === 
     107 
     108As MySQL root user: 
     109 
     110{{{ 
     111CREATE USER 'stats'@'localhost' IDENTIFIED BY '********'; 
     112GRANT USAGE ON * . * TO 'stats'@'localhost' IDENTIFIED BY '********' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ; 
     113CREATE DATABASE IF NOT EXISTS `stats` ; 
     114GRANT ALL PRIVILEGES ON `stats` . * TO 'stats'@'localhost'; 
     115FLUSH PRIVILEGES; 
     116}}} 
     117 
     118=== Web Install === 
     119 
     120MySQL settings: 
     121 
     122 * database server: 127.0.0.1 
     123 * login: stats 
     124 * password: ******** 
     125 * database name: stats 
     126 * table prefix: (blank - we don't need one, the default is piwik_) 
     127 * adapter: PDO_MYSQL 
     128 
     129Super User settings: 
     130 
     131 * super user login: webproject 
     132 * password: ******** 
     133 * email: webproject (at) transitionnetwork.org 
     134 
     135Suggested JS code: 
     136 
     137{{{ 
     138<!-- Piwik --> 
     139<script type="text/javascript"> 
     140var pkBaseURL = (("https:" == document.location.protocol) ? "https://stats.transitionnetwork.org/" : "http://stats.transitionnetwork.org/"); 
     141document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E")); 
     142</script><script type="text/javascript"> 
     143try { 
     144var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 1); 
     145piwikTracker.trackPageView(); 
     146piwikTracker.enableLinkTracking(); 
     147} catch( err ) {} 
     148</script><noscript><p><img src="http://stats.transitionnetwork.org/piwik.php?idsite=1" style="border:0" alt="" /></p></noscript> 
     149<!-- End Piwik Tracking Code --> 
     150}}} 
     151 
     152Suggested image code: 
     153 
     154{{{ 
     155<!-- Piwik Image Tracker --> 
     156<img src="https://stats.transitionnetwork.org/piwik.php?idsite=1&rec=1" style="border:0" alt="" /> 
     157<!-- End Piwik --> 
     158}}} 
     159 
     160=== Configure === 
     161 
     162In the General Settings page: 
     163 
     164 * Allow Piwik archiving to trigger when reports are viewed from the browser: no 
     165 * Reports for today (or any other Date Range including today) will be processed at most every: 1800 
     166 
     167Set up cron: 
     168 
     169{{{ 
     170crontab -u www-data -e 
     171 
     1725 * * * * /web/stats.transitionnetwork.org/piwik/misc/cron/archive.sh > /dev/null 
     173}}} 
     174 
     175Test it: 
     176 
     177{{{ 
     178su www-data -c "sh /web/stats.transitionnetwork.org/piwik/misc/cron/archive.sh" 
     179}}} 
     180 
     181This generated this error: 
     182 
     183{{{ 
     184ALERT - script tried to increase memory_limit to 134217728 bytes which is above the allowed value (attacker 'REMOTE_ADDR not set', file '/web/stats.transitionnetwork.org/piwik/core/Piwik.php', line 947) 
     185}}} 
     186 
     187Which can be ignored because in {{{/etc/php5/apache2/php.ini}}} it's set to double that already, 256M, so I don't understand why it tried to raise it. 
     188 
     189Things added to {{{/web/stats.transitionnetwork.org/piwik/config/config.ini.php}}}, taken from {{{global.ini.php}}}: 
     190 
     191{{{ 
     192[General] 
     193force_ssl_login = 1 
     194feedback_email_address = "webproject (at) transitionnetwork.org" 
     195assume_secure_protocol = 1 
     196}}} 
     197 
     198 
     199 
     200 
     201 
     202 
    6203 
    7204== Dev Server == 
    8205 
    9 == Config == 
     206=== Config === 
    10207 
    11208In {{{/web/piwik.transitionnetwork.org/piwik/config}}}