nextcloud.conf 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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. server_name NC_SERVER_SUB;
  26. root /web/nextcloud/;
  27. location = /robots.txt {
  28. allow all;
  29. log_not_found off;
  30. access_log off;
  31. }
  32. location = /.well-known/carddav {
  33. return 301 $client_req_scheme_nc://$host/remote.php/dav;
  34. }
  35. location = /.well-known/caldav {
  36. return 301 $client_req_scheme_nc://$host/remote.php/dav;
  37. }
  38. gzip on;
  39. gzip_vary on;
  40. gzip_comp_level 4;
  41. gzip_min_length 256;
  42. gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
  43. 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;
  44. set_real_ip_from 172.22.1.1;
  45. real_ip_header X-Forwarded-For;
  46. real_ip_recursive on;
  47. location / {
  48. rewrite ^ /index.php$uri;
  49. }
  50. location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
  51. deny all;
  52. }
  53. location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
  54. deny all;
  55. }
  56. location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+)\.php(?:$|/) {
  57. fastcgi_split_path_info ^(.+\.php)(/.*)$;
  58. include fastcgi_params;
  59. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  60. fastcgi_param PATH_INFO $fastcgi_path_info;
  61. #Avoid sending the security headers twice
  62. fastcgi_param modHeadersAvailable true;
  63. fastcgi_param front_controller_active true;
  64. fastcgi_pass phpfpm:9000;
  65. fastcgi_intercept_errors on;
  66. fastcgi_request_buffering off;
  67. }
  68. location ~ ^/(?:updater|ocs-provider)(?:$|/) {
  69. try_files $uri/ =404;
  70. index index.php;
  71. }
  72. location ~ \.(?:css|js|woff|svg|gif)$ {
  73. try_files $uri /index.php$uri$is_args$args;
  74. add_header Cache-Control "public, max-age=15778463";
  75. add_header X-Content-Type-Options nosniff;
  76. add_header X-XSS-Protection "1; mode=block";
  77. add_header X-Robots-Tag none;
  78. add_header X-Download-Options noopen;
  79. add_header X-Permitted-Cross-Domain-Policies none;
  80. access_log off;
  81. }
  82. location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
  83. try_files $uri /index.php$uri$is_args$args;
  84. access_log off;
  85. }
  86. }
  87. server {
  88. include /etc/nginx/conf.d/listen_ssl.active;
  89. include /etc/nginx/mime.types;
  90. charset utf-8;
  91. override_charset on;
  92. add_header X-Content-Type-Options nosniff;
  93. add_header X-XSS-Protection "1; mode=block";
  94. add_header X-Robots-Tag none;
  95. add_header X-Download-Options noopen;
  96. add_header X-Permitted-Cross-Domain-Policies none;
  97. server_name NC_SERVER_SUB;
  98. root /web/nextcloud/;
  99. location = /robots.txt {
  100. allow all;
  101. log_not_found off;
  102. access_log off;
  103. }
  104. location = /.well-known/carddav {
  105. return 301 $client_req_scheme_nc://$host/remote.php/dav;
  106. }
  107. location = /.well-known/caldav {
  108. return 301 $client_req_scheme_nc://$host/remote.php/dav;
  109. }
  110. gzip on;
  111. gzip_vary on;
  112. gzip_comp_level 4;
  113. gzip_min_length 256;
  114. gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
  115. 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;
  116. set_real_ip_from 172.22.1.1;
  117. real_ip_header X-Forwarded-For;
  118. real_ip_recursive on;
  119. location / {
  120. rewrite ^ /index.php$uri;
  121. }
  122. location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
  123. deny all;
  124. }
  125. location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
  126. deny all;
  127. }
  128. location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+)\.php(?:$|/) {
  129. fastcgi_split_path_info ^(.+\.php)(/.*)$;
  130. include fastcgi_params;
  131. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  132. fastcgi_param PATH_INFO $fastcgi_path_info;
  133. fastcgi_param modHeadersAvailable true;
  134. fastcgi_param front_controller_active true;
  135. fastcgi_pass phpfpm:9000;
  136. fastcgi_intercept_errors on;
  137. fastcgi_request_buffering off;
  138. }
  139. location ~ ^/(?:updater|ocs-provider)(?:$|/) {
  140. try_files $uri/ =404;
  141. index index.php;
  142. }
  143. location ~ \.(?:css|js|woff|svg|gif)$ {
  144. try_files $uri /index.php$uri$is_args$args;
  145. add_header Cache-Control "public, max-age=15778463";
  146. add_header X-Content-Type-Options nosniff;
  147. add_header X-XSS-Protection "1; mode=block";
  148. add_header X-Robots-Tag none;
  149. add_header X-Download-Options noopen;
  150. add_header X-Permitted-Cross-Domain-Policies none;
  151. access_log off;
  152. }
  153. location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
  154. try_files $uri /index.php$uri$is_args$args;
  155. access_log off;
  156. }
  157. }