nextcloud.conf 4.1 KB

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