moodle.stpl 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. server {
  2. listen %ip%:%web_ssl_port%;
  3. server_name %domain_idn% %alias_idn%;
  4. root %sdocroot%;
  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. ssl on;
  10. ssl_certificate %ssl_pem%;
  11. ssl_certificate_key %ssl_key%;
  12. rewrite ^/(.*\.php)(/)(.*)$ /$1?file=/$3 last;
  13. location = /favicon.ico {
  14. log_not_found off;
  15. access_log off;
  16. }
  17. location = /robots.txt {
  18. allow all;
  19. log_not_found off;
  20. access_log off;
  21. }
  22. location ~* \.(txt|log)$ {
  23. allow 192.168.0.0/16;
  24. deny all;
  25. }
  26. location ~ \..*/.*\.php$ {
  27. return 403;
  28. }
  29. # No no for private
  30. location ~ ^/sites/.*/private/ {
  31. return 403;
  32. }
  33. # Block access to "hidden" files and directories whose names begin with a
  34. # period. This includes directories used by version control systems such
  35. # as Subversion or Git to store control files.
  36. location ~ (^|/)\. {
  37. return 403;
  38. }
  39. location / {
  40. location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
  41. expires max;
  42. }
  43. location ~ [^/]\.php(/|$) {
  44. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  45. if (!-f $document_root$fastcgi_script_name) {
  46. return 404;
  47. }
  48. fastcgi_pass %backend_lsnr%;
  49. fastcgi_index index.php;
  50. fastcgi_param SCRIPT_FILENAME $request_filename;
  51. fastcgi_intercept_errors on;
  52. include /etc/nginx/fastcgi_params;
  53. }
  54. }
  55. error_page 403 /error/404.html;
  56. error_page 404 /error/404.html;
  57. error_page 500 502 503 504 /error/50x.html;
  58. location /error/ {
  59. alias %home%/%user%/web/%domain%/document_errors/;
  60. }
  61. location ~* "/\.(htaccess|htpasswd)$" {
  62. deny all;
  63. return 404;
  64. }
  65. location /vstats/ {
  66. alias %home%/%user%/web/%domain%/stats/;
  67. include %home%/%user%/conf/web/%domain%.auth*;
  68. }
  69. include /etc/nginx/conf.d/phpmyadmin.inc*;
  70. include /etc/nginx/conf.d/phppgadmin.inc*;
  71. include /etc/nginx/conf.d/webmail.inc*;
  72. include %home%/%user%/conf/web/snginx.%domain%.conf*;
  73. }