--- /dev/null
+run:
+ - replace:
+ filename: "/etc/nginx/conf.d/discourse.conf"
+ from: /server.+{/
+ to: |
+ server {
+ listen 80;
+ rewrite ^ https://$$ENV_DISCOURSE_HOSTNAME$request_uri? permanent;
+ }
+ server {
+ - replace:
+ filename: "/etc/nginx/conf.d/discourse.conf"
+ from: /listen 80;\s+gzip on;/m
+ to: |
+ listen 443 ssl spdy;
+ spdy_keepalive_timeout 300; # up from 180 secs default
+
+ ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
+
+ # courtesy of https://wiki.mozilla.org/Security/Server_Side_TLS#Recommended_Ciphersuite
+ ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:AES128:AES256:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK;
+ ssl_prefer_server_ciphers on;
+
+ ssl_certificate /shared/ssl/ssl.crt;
+ ssl_certificate_key /shared/ssl/ssl.key;
+
+ #ssl_session_tickets off;
+
+ # enable SPDY header compression
+ spdy_headers_comp 6;
+
+ # remember the certificate for a year and automatically connect to HTTPS
+ add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains';
+
+ gzip on;
+
+ if ($http_host != $$ENV_DISCOURSE_HOSTNAME) {
+ rewrite (.*) https://$$ENV_DISCOURSE_HOSTNAME$1 permanent;
+ }