Primeiro vamos instalar o LEMP e algumas depêndencias
apt-get install mysql-server php5-mysql nginx php5-fpm unzip php5-gd php5-geoip
Agora é baixar o Piwik, ajustar permissões e o banco de dados binário para geolocalização
wget http://builds.piwik.org/piwik.zip unzip piwik.zip mv piwik /home/sftp/quijaua.net/public_html/ chmod 775 /home/sftp/quijaua.net/public_html/piwik/tmp/assets/ cd /home/sftp/quijaua.net/public_html/piwik/misc wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz gunzip GeoLiteCity.dat.gz mv GeoLiteCity.dat GeoIPCity.dat chown -R quijaua: /home/sftp/quijaua.net/public_html/piwik/
depois o criar o banco de dados e ajustar as permissões
GRANT CREATE,ALTER,SELECT,INSERT,UPDATE,DELETE,DROP,CREATE TEMPORARY TABLES ON piwik.* TO 'piwik'@'localhost' identified by 'suasenha'; GRANT FILE ON *.* to 'piwik'@'localhost'; create database piwik; flush privileges;
Levando em conta que o site ficará em quijaua.net a configuração do Nginx ficou
server { listen 80; server_name quijaua.net; root /home/sftp/quijaua.net/public_html/piwik; access_log /var/log/nginx/piwik-access.log; error_log /var/log/nginx/piwik-error.log info; client_max_body_size 10m; index index.php; # Disable all methods besides HEAD, GET and POST. if ($request_method !~ ^(GET|HEAD|POST)$ ) { return 444; } # Support for favicon. Return a 204 (No Content) if the favicon # doesn't exist. location = /favicon.ico { try_files /favicon.ico =204; } # Try all locations and relay to index.php as a fallback. location / { try_files $uri /index.php; } # Return a 404 for all text files. location ~* ^/(?:README|LICENSE[^.]*|LEGALNOTICE)(?:\.txt)*$ { return 404; } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass 127.0.0.1:9001; fastcgi_index index.php ; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } }
e pool do php5-fpm
[quijaua.net] listen = 127.0.0.1:9001 listen.allowed_clients = 127.0.0.1 user = quijaua group = quijaua pm = dynamic pm.max_children = 2 pm.start_servers = 2 pm.min_spare_servers = 1 pm.max_spare_servers = 2 pm.max_requests = 500 chdir = / php_admin_value[open_basedir] = /home/sftp/quijaua.net/public_html/piwik:/usr/share/php5:/tmp/: php_admin_value[error_log] = /var/log/php-fpm/piwik-error.log php_admin_flag[log_errors] = on php_flag[display_errors] = off php_flag[file_uploads] = off php_admin_value[upload_tmp_dir] = /home/sftp/quijaua.net/tmp/ php_admin_value[session.save_path] = /home/sftp/quijaua.net/tmp/ php_flag[expose_php] = off php_flag[upload_tmp_dir] = off slowlog = /var/log/php-fpm/piwik-slow.log php_value[always_populate_raw_post_data]=-1
E reiniciar o nginx e php5-fpm
/etc/init.d/php5-fpm restart /etc/init.d/nginx restart
Agora é só entrar no endereço http://quijaua.net e inserir as informações do banco de dados e criação do usuários administrativo.