安装piwik 网站访问分析系统

centos 6.4安装piwik

yum安装lamp

yum -y install httpd php php-mysqlhttpd-manual mod_ssl mod_perl mod_auth_mysql mysql-connector-odbc mysql-devellibdbi-dbd-mysql php-gd php-xml php-mbstring php-ldap php-xmlrpc php-pearmysql-server

yum clean all

 

关闭防火墙,开启服务

/etc/init.d/iptables stop

/etc/init.d/httpd start

/etc/init.d/mysqld start

下载piwik

wgethttp://builds.piwik.org/piwik.zip

unzip piwik.zip

cp -rf piwik /var/www/html/

 

chown -R apache:apache /var/www/html/piwik

chmod -R 0755 /var/www/html/piwik/tmp

chmod -R 0755/var/www/html/piwik/tmp/assets/

chmod -R 0755/var/www/html/piwik/tmp/cache/

chmod -R 0755 /var/www/html/piwik/tmp/logs/

chmod -R 0755/var/www/html/piwik/tmp/tcpdf/

chmod -R 0755 /var/www/html/piwik/tmp/templates_c/

 

mysql> createdatabase piwik;           

mysql> grant all on piwik.* topiwik@localhost identified by '123456';

mysql> flush privileges;

 

chown -R apache:apache /var/www/html/piwik

chmod -R 0755 /var/www/html/piwik/tmp

chmod -R 0755/var/www/html/piwik/tmp/assets/

chmod -R 0755/var/www/html/piwik/tmp/cache/

chmod -R 0755 /var/www/html/piwik/tmp/logs/

chmod -R 0755/var/www/html/piwik/tmp/tcpdf/

chmod -R 0755/var/www/html/piwik/tmp/templates_c/

 

####chown -R nobody /var/www/html/piwik

访问piwik页面,出现500错误,需要禁用mod_security这个可以忽略,后面的步骤根据自身情况填写,网站我是写的是http://127.0.0.1

http://192.168.2.107/piwik

登陆之后,点击访客信息,发现没有数据

 

编辑默认的页面

vi /var/www/error/noindex.html

</body>上面一行添加以下字段:

 

<!-- Piwik -->

<scripttype="text/javascript">

  var_paq = _paq || [];

 _paq.push(['trackPageView']);

 _paq.push(['enableLinkTracking']);

 (function() {

   var u=(("https:" == document.location.protocol) ?"https" : "http") + "://192.168.2.107/piwik/";

   _paq.push(['setTrackerUrl', u+'piwik.php']);

   _paq.push(['setSiteId', 1]);

   var d=document, g=d.createElement('script'),s=d.getElementsByTagName('script')[0]; g.type='text/javascript';

   g.defer=true; g.async=true; g.src=u+'piwik.js';s.parentNode.insertBefore(g,s);

 })();

</script>

<noscript><p><imgsrc="http://192.168.2.107/piwik/piwik.php?idsite=1"style="border:0;" alt="" /></p></noscript>

<!-- End Piwik Code -->

 

重启httpd服务

/etc/init.d/httpd restart

 

再次访问piwik,点击访客信息,发现一条数据


你可能感兴趣的:(日志分析,网站,pv,UV)