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