Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2015
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. error_page 404 /assets/error-404.html;
  2. error_page 500 /assets/error-500.html;
  3.  
  4. location / {
  5. try_files $uri @silverstripe;
  6. }
  7.  
  8. location @silverstripe {
  9. fastcgi_keep_conn on;
  10. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  11. fastcgi_pass unix:/var/run/php-fpm.sock;
  12. fastcgi_index index.php;
  13. include fastcgi.conf;
  14. fastcgi_read_timeout 120;
  15. fastcgi_connect_timeout 60;
  16. fastcgi_send_timeout 120;
  17. fastcgi_buffer_size 64k;
  18. fastcgi_buffers 4 65k;
  19. fastcgi_busy_buffers_size 128k;
  20.  
  21. fastcgi_param SCRIPT_FILENAME $document_root/framework/main.php;
  22. fastcgi_param SCRIPT_NAME /framework/main.php;
  23. fastcgi_param QUERY_STRING url=$uri&$args;
  24. }
  25.  
  26. location ~* \.php$ {
  27. fastcgi_keep_conn on;
  28. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  29. fastcgi_pass unix:/var/run/php-fpm.sock;
  30. fastcgi_index index.php;
  31. include fastcgi.conf;
  32. fastcgi_read_timeout 120;
  33. fastcgi_connect_timeout 60;
  34. fastcgi_send_timeout 120;
  35. fastcgi_buffer_size 64k;
  36. fastcgi_buffers 4 65k;
  37. fastcgi_busy_buffers_size 128k;
  38. }
  39.  
  40. # Deny access to silverstripe-cache
  41. location ~ ^/silverstripe-cache {
  42. deny all;
  43. }
  44.  
  45. # Deny access to logs
  46. location ~ ^/logs {
  47. deny all;
  48. }
  49.  
  50. # Don't execute scripts in the assets folder
  51. location ^~ /assets/ {
  52. sendfile on;
  53. try_files $uri $uri/ =404;
  54. }
  55.  
  56. # Deny access to composer
  57. location ~ ^/(vendor|composer.json|composer.lock) {
  58. deny all;
  59. }
  60.  
  61. # Deny access to yaml files
  62. location ~ \.yml$ {
  63. deny all;
  64. }
  65.  
  66. # Deny access to template files
  67. location ~ \.ss$ {
  68. satisfy any;
  69. allow 127.0.0.1;
  70. deny all;
  71. }
  72.  
  73. # CMS & Framework .htaccess rules
  74. location ~ ^/(cms|framework|mysite)/.*\.(php|php[345]|phtml|inc)$ {
  75. deny all;
  76. }
  77. location ~ ^/(cms|framework)/silverstripe_version$ {
  78. deny all;
  79. }
  80. location ~ ^/framework/.*(main|static-main|rpc|tiny_mce_gzip)\.php$ {
  81. allow all;
  82. }
  83.  
  84. # Deny access to all dot files
  85. location ~ /\. {
  86. deny all;
  87. }
  88.  
  89. # Enable browser cache for static files and don't log them
  90. location ~* ^.+.(htm|html|jpg|jpeg|gif|png|svg|ico|css|zip|tgz|gz|rar|bz2|doc|docx|xls|xlsx|pdf|ppt|pptx|txt|tar|mid|midi|wav|bmp|rtf|js)$ {
  91. access_log off;
  92. expires max;
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement