piwik.tpl 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. server {
  2. listen %ip%:%web_port%;
  3. server_name %domain_idn% %alias_idn%;
  4. root %docroot%;
  5. index index.php index.html index.htm;
  6. access_log /var/log/nginx/domains/%domain%.log combined;
  7. access_log /var/log/nginx/domains/%domain%.bytes bytes;
  8. error_log /var/log/nginx/domains/%domain%.error.log error;
  9. include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;
  10. location = /favicon.ico {
  11. try_files /favicon.ico =204;
  12. }
  13. location / {
  14. try_files $uri /index.php;
  15. location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
  16. valid_referers none blocked %domain_idn% %alias_idn%;
  17. if ($invalid_referer) {
  18. return 444;
  19. }
  20. expires max;
  21. }
  22. location ~* ^/(?:index|piwik)\.php$ {
  23. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  24. if (!-f $document_root$fastcgi_script_name) {
  25. return 404;
  26. }
  27. fastcgi_pass %backend_lsnr%;
  28. include /etc/nginx/fastcgi_params;
  29. }
  30. }
  31. # Any other attempt to access PHP files returns a 404.
  32. location ~* ^.+\.php$ {
  33. return 404;
  34. }
  35. # Return a 404 for all text files.
  36. location ~* ^/(?:README|LICENSE[^.]*|LEGALNOTICE)(?:\.txt)*$ {
  37. return 404;
  38. }
  39. error_page 403 /error/404.html;
  40. error_page 404 /error/404.html;
  41. error_page 500 502 503 504 /error/50x.html;
  42. location /error/ {
  43. alias %home%/%user%/web/%domain%/document_errors/;
  44. }
  45. location ~* "/\.(htaccess|htpasswd)$" {
  46. deny all;
  47. return 404;
  48. }
  49. location /vstats/ {
  50. alias %home%/%user%/web/%domain%/stats/;
  51. include %home%/%user%/conf/web/%domain%.auth*;
  52. }
  53. include /etc/nginx/conf.d/phpmyadmin.inc*;
  54. include /etc/nginx/conf.d/phppgadmin.inc*;
  55. include %home%/%user%/conf/web/%domain%/nginx.conf_*;
  56. }