moodle.stpl 2.4 KB

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