- server {
- listen 8001;
- server_name localhost;
- access_log /var/log/nginx/piwik.access.log;
- error_log /var/log/nginx/piwik.error.log;
- # Disable all methods besides HEAD, GET and POST.
- if ($request_method !~ ^(GET|HEAD|POST)$ ) {return 444;}
- root /home/tohuw/piwik/;
- include global/indexes.conf;
- # Disallow any usage of piwik assets if referer is non valid.
- location ~* ^.+\.(?:jpg|png|css|gif|jpeg|js|swf)$ {
- # Defining the valid referers.
- valid_referers none blocked *.mysite.com othersite.com;
- if ($invalid_referer) {return 444;}
- expires max;
- break;
- }
- # 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;}
- # Relay all index.php requests to fastcgi.
- location ~* ^/(?:index|piwik)\.php$ {fastcgi_pass unix:/tmp/php-cgi/php-cgi.socket;}
- # Any other attempt to access PHP files returns a 404.
- location ~* ^.+\.php$ {return 404;}
- # Return a 404 for all text files.
- location ~* ^/(?:README|LICENSE[^.]*|LEGALNOTICE)(?:\.txt)*$ {return 404;}
- # # The 404 is signaled through a static page.
- # error_page 404 /404.html;
- # ## All server error pages go to 50x.html at the document root.
- # error_page 500 502 503 504 /50x.html;
- # location = /50x.html {
- # root /var/www/nginx-default;
- # }
- }