default.conf 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. server {
  2. listen 80;
  3. server_name _;
  4. root /usr/share/nginx/html;
  5. index index.html;
  6. location = /oo-preview.html {
  7. if_modified_since off;
  8. etag off;
  9. add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0" always;
  10. add_header Pragma "no-cache" always;
  11. add_header Expires "0" always;
  12. }
  13. location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?|ttf|eot)$ {
  14. expires 30d;
  15. add_header Cache-Control "public, immutable";
  16. }
  17. location /pdfs/ {
  18. alias /data/pdfs/;
  19. add_header Content-Disposition "inline";
  20. add_header X-Content-Type-Options "nosniff";
  21. add_header Cache-Control "no-store";
  22. }
  23. location /excels/ {
  24. alias /data/excels/;
  25. add_header X-Frame-Options "SAMEORIGIN";
  26. add_header Cache-Control "no-store";
  27. }
  28. location /words/ {
  29. alias /data/words/;
  30. add_header X-Frame-Options "SAMEORIGIN";
  31. add_header Cache-Control "no-store";
  32. }
  33. location /raw/excels/ {
  34. alias /data/raw_excels/;
  35. add_header Cache-Control "no-store";
  36. }
  37. location /raw/words/ {
  38. alias /data/raw_words/;
  39. add_header Cache-Control "no-store";
  40. }
  41. location /raw/files/ {
  42. alias /data/uploads/;
  43. add_header Cache-Control "no-store";
  44. }
  45. location = /onlyoffice-callback {
  46. default_type application/json;
  47. add_header Cache-Control "no-store" always;
  48. return 200 '{"error":0}';
  49. }
  50. location ^~ /onlyoffice/ {
  51. proxy_pass http://onlyoffice:80/;
  52. proxy_http_version 1.1;
  53. proxy_set_header Host $http_host;
  54. proxy_set_header X-Forwarded-Host $http_host;
  55. proxy_set_header X-Forwarded-Port $server_port;
  56. proxy_set_header X-Forwarded-Proto $scheme;
  57. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  58. proxy_set_header Upgrade $http_upgrade;
  59. proxy_set_header Connection "upgrade";
  60. proxy_set_header X-Real-IP $remote_addr;
  61. proxy_read_timeout 3600;
  62. proxy_send_timeout 3600;
  63. proxy_buffering off;
  64. }
  65. location ^~ /cache/ {
  66. proxy_pass http://onlyoffice:80/cache/;
  67. proxy_http_version 1.1;
  68. proxy_set_header Host $http_host;
  69. proxy_set_header X-Forwarded-Host $http_host;
  70. proxy_set_header X-Forwarded-Port $server_port;
  71. proxy_set_header X-Forwarded-Proto $scheme;
  72. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  73. proxy_set_header X-Real-IP $remote_addr;
  74. proxy_read_timeout 3600;
  75. proxy_send_timeout 3600;
  76. proxy_buffering off;
  77. }
  78. location / {
  79. try_files $uri $uri/ $uri.html =404;
  80. }
  81. error_page 404 /404.html;
  82. }