ds-docservice.conf 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #welcome page
  2. rewrite ^/$ $the_scheme://$the_host$the_prefix/welcome/ redirect;
  3. #script caching protection
  4. rewrite ^(?<cache>\/web-apps\/apps\/(?!api\/).*)$ $the_scheme://$the_host$the_prefix/8.3.0-$cache_tag$cache redirect;
  5. #disable caching for api.js
  6. location ~ ^(\/[\d]+\.[\d]+\.[\d]+[\.|-][\w]+)?\/(web-apps\/apps\/api\/documents\/api\.js)$ {
  7. expires -1;
  8. gzip_static on;
  9. alias /var/www/onlyoffice/documentserver/$2;
  10. }
  11. #suppress logging the unsupported locale error in web-apps
  12. location ~ ^(\/[\d]+\.[\d]+\.[\d]+[\.|-][\w]+)?\/(web-apps)(\/.*\.json)$ {
  13. expires 365d;
  14. error_log /dev/null crit;
  15. gzip_static on;
  16. alias /var/www/onlyoffice/documentserver/$2$3;
  17. }
  18. #suppress logging the unsupported locale error in plugins
  19. location ~ ^(\/[\d]+\.[\d]+\.[\d]+[\.|-][\w]+)?\/(sdkjs-plugins)(\/.*\.json)$ {
  20. expires 365d;
  21. error_log /dev/null crit;
  22. gzip_static on;
  23. alias /var/www/onlyoffice/documentserver/$2$3;
  24. }
  25. location ~ ^(\/[\d]+\.[\d]+\.[\d]+[\.|-][\w]+)?\/(web-apps|sdkjs|sdkjs-plugins|fonts|dictionaries)(\/.*)$ {
  26. expires 365d;
  27. gzip_static on;
  28. alias /var/www/onlyoffice/documentserver/$2$3;
  29. }
  30. location ~* ^(\/cache\/files.*)(\/.*) {
  31. alias /var/lib/onlyoffice/documentserver/App_Data$1;
  32. add_header Content-Disposition "attachment; filename*=UTF-8''$arg_filename";
  33. # secure_link disabled for internal preview stability
  34. }
  35. # Allow "/internal" interface only from 127.0.0.1
  36. # Don't comment out the section below for the security reason!
  37. location ~* ^(\/[\d]+\.[\d]+\.[\d]+[\.|-][\w]+)?\/(internal)(\/.*)$ {
  38. allow 127.0.0.1;
  39. deny all;
  40. proxy_pass http://docservice/$2$3;
  41. }
  42. # Allow "/info" interface only from 127.0.0.1 by default
  43. # Comment out lines allow 127.0.0.1; and deny all;
  44. # of below section to turn on the info page
  45. location ~* ^(\/[\d]+\.[\d]+\.[\d]+[\.|-][\w]+)?\/(info)(\/.*)$ {
  46. allow 127.0.0.1;
  47. deny all;
  48. proxy_pass http://docservice/$2$3;
  49. }
  50. location / {
  51. proxy_pass http://docservice;
  52. }
  53. location ~ ^/([\d]+\.[\d]+\.[\d]+[\.|-][\w]+)/(?<path>.*)$ {
  54. proxy_pass http://docservice/$path$is_args$args;
  55. proxy_http_version 1.1;
  56. }