1

I have a problem setting up uWSGI+piwik using nginx. My configuration follows this blog entry. My uwsgi ini file looks like this

[uwsgi]
plugins = php
chown-socket = www-data:www-data
uid = piwik
gid = piwik
processes = 1                                                                                 

and my nginx config

server {
    listen 80;
    root /var/www/piwik;
    server_name my.domain.com;
    index piwik.php;
    # For administrative access
    location = /index.php {
        include uwsgi_params;
        uwsgi_modifier1 14;
        uwsgi_pass unix:/var/run/uwsgi/app/piwik/socket;
        allow 127.0.0.1; # only via ssh tunnel
        deny all;
    }
    # For public access
    location = /piwik.php {
        include uwsgi_params;
        uwsgi_modifier1 14;
        uwsgi_pass unix:/var/run/uwsgi/app/piwik/socket;
    }
    # Any other attempt to access PHP files is forbidden
    location ~* ^.+\.php$ {
        return 403;
    }
    # Redirect to the root if attempting to access a txt file.
    location ~* (?:DESIGN|(?:gpl|README|LICENSE)[^.]*|LEGALNOTICE)(?:\.txt)*$ {
        return 302 /;
    }
    # Disallow access to several helper files.
    location ~* \.(?:bat|html?|git|ini|sh|svn[^.]*|txt|tpl|xml)$ {
        return 404;
    }
    # Disallow access to directories
    location ~ ^/(config|core|lang|misc|tmp)/ {
        deny all;
    }
}

The log file contains this, which indicates the error:

Tue Aug 25 15:34:34 2015 - PHP Fatal error:  Uncaught exception 'Exception' with message 'The configuration file {/var/www/piwik/config/config.ini.php} has not been found or could not be read.' in /var/www/piwik/core/Application/Kernel/EnvironmentValidator.php:64
Stack trace:
#0 /var/www/piwik/core/Application/Kernel/EnvironmentValidator.php(45): Piwik\Application\Kernel\EnvironmentValidator->checkConfigFileExists('/var/www/piwik/...', false)
#1 /var/www/piwik/core/Application/Environment.php(185): Piwik\Application\Kernel\EnvironmentValidator->validate()
#2 /var/www/piwik/core/Application/Environment.php(94): Piwik\Application\Environment->validateEnvironment()
#3 /var/www/piwik/piwik.php(56): Piwik\Application\Environment->init()
#4 {main}
  thrown in /var/www/piwik/core/Application/Kernel/EnvironmentValidator.php on line 64
[pid: 23656|app: -1|req: -1/3] 109.90.112.120 () {36 vars in 567 bytes} [Tue Aug 25 15:34:34 2015] GET / => generated 0 bytes in 58 msecs (HTTP/1.1 500) 1 headers in 78 bytes (0 switches on core 0)

When I open the page with a browser a log entry like this is generated and I see a blank page (makes sense with 0 generated bytes). The problem is that the expected Piwik install script does not start. Instead an exception is thrown. I tried to change /var/www/piwik/core/Application/Kernel/EnvironmentValidator.php to manually trigger the setup but did not succeed. Do you have any ideas?

0

You are questing /piwik.php (if you requesting /, /piwik.php is marked as default). /piwik.php is the tracker. You have to request /index.php before and use web administration interface to produce the config file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.