2
0

nextcloud.conf 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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/webfinger {
  42. return 301 $client_req_scheme_nc://$host/index.php/.well-known/webfinger;
  43. }
  44. location = /.well-known/nodeinfo {
  45. return 301 $client_req_scheme_nc://$host/index.php/.well-known/nodeinfo;
  46. }
  47. location ^~ /.well-known/acme-challenge/ {
  48. default_type "text/plain";
  49. root /web;
  50. }
  51. fastcgi_buffers 64 4K;
  52. gzip on;
  53. gzip_vary on;
  54. gzip_comp_level 4;
  55. gzip_min_length 256;
  56. gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
  57. 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;
  58. set_real_ip_from fc00::/7;
  59. set_real_ip_from 10.0.0.0/8;
  60. set_real_ip_from 172.16.0.0/12;
  61. set_real_ip_from 192.168.0.0/16;
  62. real_ip_header X-Forwarded-For;
  63. real_ip_recursive on;
  64. location / {
  65. rewrite ^ /index.php$uri;
  66. }
  67. location ~ ^\/(?:build|tests|config|lib|3rdparty|templates|data)\/ {
  68. deny all;
  69. }
  70. location ~ ^\/(?:\.|autotest|occ|issue|indie|db_|console) {
  71. deny all;
  72. }
  73. location ~ ^\/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+)\.php(?:$|\/) {
  74. fastcgi_split_path_info ^(.+?\.php)(\/.*|)$;
  75. set $path_info $fastcgi_path_info;
  76. try_files $fastcgi_script_name =404;
  77. include fastcgi_params;
  78. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  79. fastcgi_param PATH_INFO $path_info;
  80. fastcgi_param HTTPS on;
  81. # Avoid sending the security headers twice
  82. fastcgi_param modHeadersAvailable true;
  83. # Enable pretty urls
  84. fastcgi_param front_controller_active true;
  85. fastcgi_pass phpfpm:9002;
  86. fastcgi_intercept_errors on;
  87. fastcgi_request_buffering off;
  88. client_max_body_size 0;
  89. fastcgi_read_timeout 1200;
  90. }
  91. location ~ ^\/(?:updater|oc[ms]-provider)(?:$|\/) {
  92. try_files $uri/ =404;
  93. index index.php;
  94. }
  95. location ~ \.(?:css|js|woff2?|svg|gif|map)$ {
  96. try_files $uri /index.php$request_uri;
  97. add_header Cache-Control "public, max-age=15778463";
  98. add_header Referrer-Policy "no-referrer" always;
  99. add_header X-Content-Type-Options "nosniff" always;
  100. add_header X-Download-Options "noopen" always;
  101. add_header X-Frame-Options "SAMEORIGIN" always;
  102. add_header X-Permitted-Cross-Domain-Policies "none" always;
  103. add_header X-Robots-Tag "none" always;
  104. add_header X-XSS-Protection "1; mode=block" always;
  105. access_log off;
  106. }
  107. location ~ \.(?:png|html|ttf|ico|jpg|jpeg|bcmap)$ {
  108. try_files $uri /index.php$request_uri;
  109. access_log off;
  110. }
  111. }