nextcloud.conf 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. map $http_x_forwarded_proto $client_req_scheme_nc {
  2. default $scheme;
  3. https https;
  4. }
  5. server {
  6. include /etc/nginx/conf.d/listen_ssl.active;
  7. include /etc/nginx/conf.d/listen_plain.active;
  8. include /etc/nginx/mime.types;
  9. charset utf-8;
  10. override_charset on;
  11. ssl_certificate /etc/ssl/mail/cert.pem;
  12. ssl_certificate_key /etc/ssl/mail/key.pem;
  13. ssl_protocols TLSv1.2;
  14. ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
  15. ssl_prefer_server_ciphers on;
  16. ssl_session_cache shared:SSL:50m;
  17. ssl_session_timeout 1d;
  18. ssl_session_tickets off;
  19. add_header Referrer-Policy "no-referrer" always;
  20. add_header X-Content-Type-Options "nosniff" always;
  21. add_header X-Download-Options "noopen" always;
  22. add_header X-Frame-Options "SAMEORIGIN" always;
  23. add_header X-Permitted-Cross-Domain-Policies "none" always;
  24. add_header X-Robots-Tag "none" always;
  25. add_header X-XSS-Protection "1; mode=block" always;
  26. fastcgi_hide_header X-Powered-By;
  27. server_name NC_SUBD;
  28. root /web/nextcloud/;
  29. location = /robots.txt {
  30. allow all;
  31. log_not_found off;
  32. access_log off;
  33. }
  34. location = /.well-known/carddav {
  35. return 301 $client_req_scheme_nc://$host/remote.php/dav;
  36. }
  37. location = /.well-known/caldav {
  38. return 301 $client_req_scheme_nc://$host/remote.php/dav;
  39. }
  40. location ^~ /.well-known/acme-challenge/ {
  41. default_type "text/plain";
  42. root /web;
  43. }
  44. fastcgi_buffers 64 4K;
  45. gzip on;
  46. gzip_vary on;
  47. gzip_comp_level 4;
  48. gzip_min_length 256;
  49. gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
  50. gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;
  51. set_real_ip_from fc00::/7;
  52. set_real_ip_from 10.0.0.0/8;
  53. set_real_ip_from 172.16.0.0/12;
  54. set_real_ip_from 192.168.0.0/16;
  55. real_ip_header X-Forwarded-For;
  56. real_ip_recursive on;
  57. location / {
  58. rewrite ^ /index.php$uri;
  59. }
  60. location ~ ^\/(?:build|tests|config|lib|3rdparty|templates|data)\/ {
  61. deny all;
  62. }
  63. location ~ ^\/(?:\.|autotest|occ|issue|indie|db_|console) {
  64. deny all;
  65. }
  66. location ~ ^\/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+)\.php(?:$|\/) {
  67. fastcgi_split_path_info ^(.+?\.php)(\/.*|)$;
  68. set $path_info $fastcgi_path_info;
  69. try_files $fastcgi_script_name =404;
  70. include fastcgi_params;
  71. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  72. fastcgi_param PATH_INFO $path_info;
  73. fastcgi_param HTTPS on;
  74. # Avoid sending the security headers twice
  75. fastcgi_param modHeadersAvailable true;
  76. # Enable pretty urls
  77. fastcgi_param front_controller_active true;
  78. fastcgi_pass phpfpm:9002;
  79. fastcgi_intercept_errors on;
  80. fastcgi_request_buffering off;
  81. client_max_body_size 0;
  82. fastcgi_read_timeout 1200;
  83. }
  84. location ~ ^\/(?:updater|oc[ms]-provider)(?:$|\/) {
  85. try_files $uri/ =404;
  86. index index.php;
  87. }
  88. location ~ \.(?:css|js|woff2?|svg|gif|map)$ {
  89. try_files $uri /index.php$request_uri;
  90. add_header Cache-Control "public, max-age=15778463";
  91. add_header Referrer-Policy "no-referrer" always;
  92. add_header X-Content-Type-Options "nosniff" always;
  93. add_header X-Download-Options "noopen" always;
  94. add_header X-Frame-Options "SAMEORIGIN" always;
  95. add_header X-Permitted-Cross-Domain-Policies "none" always;
  96. add_header X-Robots-Tag "none" always;
  97. add_header X-XSS-Protection "1; mode=block" always;
  98. access_log off;
  99. }
  100. location ~ \.(?:png|html|ttf|ico|jpg|jpeg|bcmap)$ {
  101. try_files $uri /index.php$request_uri;
  102. access_log off;
  103. }
  104. }