apache2_nc.j2 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. ################################################################################
  2. # This file was generated by Ansible for {{ansible_fqdn}}
  3. # Do NOT modify this file by hand!
  4. ################################################################################
  5. {% if nextcloud_install_tls and nextcloud_tls_enforce %}
  6. {% for domain in nextcloud_trusted_domain %}
  7. <VirtualHost *:80>
  8. ServerName {{ domain }}
  9. Redirect permanent / https://{{ domain | ansible.utils.ipwrap }}/
  10. </VirtualHost>
  11. {% endfor %}
  12. {% else %}
  13. <VirtualHost *:80>
  14. ServerName {{ nextcloud_trusted_domain[0] }}
  15. {% for index in range(1, nextcloud_trusted_domain|length) %}
  16. ServerAlias {{ nextcloud_trusted_domain[index]}}
  17. {% endfor %}
  18. DocumentRoot {{ nextcloud_webroot }}
  19. {% if (nextcloud_max_upload_size_in_bytes|int) <= 2147483647-%}
  20. LimitRequestBody {{ nextcloud_max_upload_size_in_bytes }}
  21. {% endif -%}
  22. <Directory {{ nextcloud_webroot }}>
  23. Allow from all
  24. Satisfy Any
  25. Options +FollowSymlinks
  26. AllowOverride All
  27. <IfModule mod_dav.c>
  28. Dav off
  29. </IfModule>
  30. SetEnv HOME {{ nextcloud_webroot }}
  31. SetEnv HTTP_HOME {{ nextcloud_webroot }}
  32. </Directory>
  33. </VirtualHost>
  34. {% endif %}
  35. {% if nextcloud_install_tls %}
  36. <VirtualHost *:443>
  37. ServerName {{ nextcloud_trusted_domain[0] }}
  38. {% for index in range(1, nextcloud_trusted_domain|length) %}
  39. ServerAlias {{ nextcloud_trusted_domain[index]}}
  40. {% endfor %}
  41. DocumentRoot {{ nextcloud_webroot }}
  42. {% if (nextcloud_max_upload_size_in_bytes|int) <= 2147483647-%}
  43. LimitRequestBody {{ nextcloud_max_upload_size_in_bytes }}
  44. {% endif -%}
  45. SSLEngine on
  46. SSLCertificateFile {{ nextcloud_tls_cert_file }}
  47. SSLCertificateKeyFile {{ nextcloud_tls_cert_key_file }}
  48. {% if nextcloud_tls_cert_chain_file is defined %}
  49. SSLCertificateChainFile {{ nextcloud_tls_cert_chain_file }}
  50. {% endif %}
  51. # enable HTTP/2, if available
  52. Protocols h2 http/1.1
  53. {% if nextcloud_hsts is string %}
  54. <IfModule mod_headers.c>
  55. Header always set Strict-Transport-Security "{{ nextcloud_hsts }}"
  56. </IfModule>
  57. {% endif %}
  58. <Directory {{ nextcloud_webroot }}>
  59. Allow from all
  60. Satisfy Any
  61. Options +FollowSymlinks
  62. AllowOverride All
  63. <IfModule mod_dav.c>
  64. Dav off
  65. </IfModule>
  66. SetEnv HOME {{ nextcloud_webroot }}
  67. SetEnv HTTP_HOME {{ nextcloud_webroot }}
  68. </Directory>
  69. </VirtualHost>
  70. {% endif %}
  71. {% if nextcloud_install_tls %}
  72. {% if nextcloud_mozilla_modern_ssl_profile %}
  73. # modern configuration, tweak to your needs
  74. SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1 -TLSv1.2
  75. {% else %}
  76. # intermediate configuration, tweak to your needs
  77. SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1
  78. SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
  79. {% endif %}
  80. SSLHonorCipherOrder off
  81. # SSLSessionTickets off
  82. SSLCompression off
  83. # OCSP stapling
  84. SSLUseStapling on
  85. SSLStaplingResponderTimeout 5
  86. SSLStaplingReturnResponderErrors off
  87. SSLStaplingCache shmcb:/var/run/ocsp(128000)
  88. {% endif %}