nextcloud.conf 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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 Strict-Transport-Security "max-age=15768000; includeSubDomains";
  20. add_header X-Content-Type-Options nosniff;
  21. add_header X-XSS-Protection "1; mode=block";
  22. add_header X-Robots-Tag none;
  23. add_header X-Download-Options noopen;
  24. add_header X-Permitted-Cross-Domain-Policies none;
  25. #add_header X-Frame-Options "SAMEORIGIN";
  26. add_header Referrer-Policy "no-referrer";
  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. gzip on;
  45. gzip_vary on;
  46. gzip_comp_level 4;
  47. gzip_min_length 256;
  48. gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
  49. 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;
  50. set_real_ip_from fc00::/7;
  51. set_real_ip_from 10.0.0.0/8;
  52. set_real_ip_from 172.16.0.0/12;
  53. set_real_ip_from 192.168.0.0/16;
  54. real_ip_header X-Forwarded-For;
  55. real_ip_recursive on;
  56. location / {
  57. rewrite ^ /index.php$uri;
  58. }
  59. location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
  60. deny all;
  61. }
  62. location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
  63. deny all;
  64. }
  65. location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|oc[ms]-provider/.+)\.php(?:$|/) {
  66. fastcgi_split_path_info ^(.+\.php)(/.*)$;
  67. include fastcgi_params;
  68. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  69. fastcgi_param PATH_INFO $fastcgi_path_info;
  70. #Avoid sending the security headers twice
  71. fastcgi_param modHeadersAvailable true;
  72. fastcgi_param front_controller_active true;
  73. fastcgi_pass phpfpm:9002;
  74. fastcgi_intercept_errors on;
  75. fastcgi_request_buffering off;
  76. client_max_body_size 0;
  77. fastcgi_read_timeout 1200;
  78. }
  79. location ~ ^/(?:updater|oc[ms]-provider)(?:$|/) {
  80. try_files $uri/ =404;
  81. index index.php;
  82. }
  83. location ~ \.(?:css|js|woff2?|svg|gif)$ {
  84. try_files $uri /index.php$uri$is_args$args;
  85. add_header Cache-Control "public, max-age=15778463";
  86. add_header X-Content-Type-Options nosniff;
  87. add_header X-XSS-Protection "1; mode=block";
  88. add_header X-Robots-Tag none;
  89. add_header X-Download-Options noopen;
  90. add_header X-Permitted-Cross-Domain-Policies none;
  91. access_log off;
  92. }
  93. location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
  94. try_files $uri /index.php$uri$is_args$args;
  95. access_log off;
  96. }
  97. }