apache2_nc_conf.j2 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <VirtualHost *:80>
  2. DocumentRoot {{ http_webroot }}/nextcloud
  3. RewriteEngine On
  4. RewriteCond %{SERVER_NAME} ={{ ansible_fqdn }}
  5. RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
  6. </VirtualHost>
  7. <IfModule mod_ssl.c>
  8. <VirtualHost *:443>
  9. SSLEngine on
  10. SSLOptions +StrictRequire
  11. LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" vhost_combined
  12. LogFormat "%v %h %l %u %t \"%r\" %>s %b" vhost_common
  13. ServerName {{ ansible_fqdn }}
  14. ServerAdmin admin@{{ ansible_fqdn }}
  15. DocumentRoot {{ http_webroot }}/nextcloud
  16. SSLCertificateFile {{ ssl_path }}/{{ ansible_fqdn }}.crt
  17. SSLCertificateKeyFile {{ ssl_path }}/{{ ansible_fqdn }}.key
  18. <Directory {{ http_webroot }}/nextcloud/>
  19. Options +FollowSymlinks
  20. AllowOverride All
  21. <IfModule mod_dav.c>
  22. Dav off
  23. </IfModule>
  24. <Files ".ht*">
  25. Require all denied
  26. </Files>
  27. SetEnv HOME {{ http_webroot }}/nextcloud
  28. SetEnv HTTP_HOME {{ http_webroot }}/nextcloud
  29. # Fix zero file sizes
  30. # See https://github.com/nextcloud/server/issues/3056#issuecomment-954209565
  31. SetEnv proxy-sendcl 1
  32. # See https://httpd.apache.org/docs/current/en/mod/core.html#limitrequestbody
  33. LimitRequestBody 0
  34. </Directory>
  35. <IfModule mod_headers.c>
  36. Header always set Strict-Transport-Security "max-age=15768000; preload"
  37. #Header set Referrer-Policy "strict-origin-when-cross-origin"
  38. #Header set X-Content-Type-Options "nosniff"
  39. #Header always set X-Frame-Options "SAMEORIGIN"
  40. </IfModule>
  41. </VirtualHost>
  42. {% if ssl_status is sameas true %}
  43. SSLProtocol -all +TLSv1.3 +TLSv1.2
  44. {% else %}
  45. SSLProtocol -all +TLSv1.2
  46. {% endif %}
  47. SSLCipherSuite TLS-CHACHA20-POLY1305-SHA256:TLS-AES-256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384
  48. SSLHonorCipherOrder on
  49. SSLCompression off
  50. SSLSessionTickets off
  51. SSLUseStapling off
  52. SSLStaplingResponderTimeout 5
  53. SSLStaplingReturnResponderErrors off
  54. SSLStaplingCache shmcb:/var/run/ocsp(128000)
  55. {% if web_status is sameas true %}
  56. SSLOpenSSLConfCmd Curves X448:secp521r1:secp384r1:prime256v1
  57. SSLOpenSSLConfCmd ECDHParameters secp384r1
  58. SSLOpenSSLConfCmd DHParameters "{{ ssl_path }}/dhparams.pem"
  59. {% endif %}
  60. SSLRandomSeed startup file:/dev/urandom 1024
  61. SSLRandomSeed connect file:/dev/urandom 1024
  62. </IfModule>