nextcloud.conf 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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/mime.types;
  8. charset utf-8;
  9. override_charset on;
  10. ssl 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. server_name NC_SUBD;
  27. root /web/nextcloud/;
  28. location = /robots.txt {
  29. allow all;
  30. log_not_found off;
  31. access_log off;
  32. }
  33. location = /.well-known/carddav {
  34. return 301 $client_req_scheme_nc://$host/remote.php/dav;
  35. }
  36. location = /.well-known/caldav {
  37. return 301 $client_req_scheme_nc://$host/remote.php/dav;
  38. }
  39. location ^~ /.well-known/acme-challenge/ {
  40. default_type "text/plain";
  41. root /web;
  42. }
  43. gzip on;
  44. gzip_vary on;
  45. gzip_comp_level 4;
  46. gzip_min_length 256;
  47. gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
  48. 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;
  49. set_real_ip_from fc00::/7;
  50. set_real_ip_from 10.0.0.0/8;
  51. set_real_ip_from 172.16.0.0/12;
  52. set_real_ip_from 192.168.0.0/16;
  53. real_ip_header X-Forwarded-For;
  54. real_ip_recursive on;
  55. location / {
  56. rewrite ^ /index.php$uri;
  57. }
  58. location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
  59. deny all;
  60. }
  61. location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
  62. deny all;
  63. }
  64. location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+)\.php(?:$|/) {
  65. fastcgi_split_path_info ^(.+\.php)(/.*)$;
  66. include fastcgi_params;
  67. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  68. fastcgi_param PATH_INFO $fastcgi_path_info;
  69. #Avoid sending the security headers twice
  70. fastcgi_param modHeadersAvailable true;
  71. fastcgi_param front_controller_active true;
  72. fastcgi_pass phpfpm:9002;
  73. fastcgi_intercept_errors on;
  74. fastcgi_request_buffering off;
  75. client_max_body_size 0;
  76. fastcgi_read_timeout 1200;
  77. }
  78. location ~ ^/(?:updater|ocs-provider)(?:$|/) {
  79. try_files $uri/ =404;
  80. index index.php;
  81. }
  82. location ~ \.(?:css|js|woff|svg|gif)$ {
  83. try_files $uri /index.php$uri$is_args$args;
  84. add_header Cache-Control "public, max-age=15778463";
  85. add_header X-Content-Type-Options nosniff;
  86. add_header X-XSS-Protection "1; mode=block";
  87. add_header X-Robots-Tag none;
  88. add_header X-Download-Options noopen;
  89. add_header X-Permitted-Cross-Domain-Policies none;
  90. access_log off;
  91. }
  92. location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
  93. try_files $uri /index.php$uri$is_args$args;
  94. access_log off;
  95. }
  96. }