diff --git a/config/nginx/templates/cms.conf.templ b/config/nginx/templates/cms.conf.templ index 4ab21ed..ce94b9d 100644 --- a/config/nginx/templates/cms.conf.templ +++ b/config/nginx/templates/cms.conf.templ @@ -1,7 +1,20 @@ +{% if ACTIVATE_HTTPS %} server { - listen 80; + server_name {{ CMS_HOST }}; + listen 80; + return 301 https://$server_name$request_uri; +} +{% endif %} + +server { + listen {{ "443 ssl" if ACTIVATE_HTTPS else "80" }}; server_name studio.localhost {{ CMS_HOST }}; - + + {% if ACTIVATE_HTTPS %} + ssl_certificate /etc/letsencrypt/live/{{ LMS_HOST }}/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/{{ LMS_HOST }}/privkey.pem; + {% endif %} + # Prevent invalid display courseware in IE 10+ with high privacy settings add_header P3P 'CP="Open edX does not have a P3P policy."'; diff --git a/config/nginx/templates/lms.conf.templ b/config/nginx/templates/lms.conf.templ index a481085..4128242 100644 --- a/config/nginx/templates/lms.conf.templ +++ b/config/nginx/templates/lms.conf.templ @@ -14,7 +14,7 @@ server { ssl_certificate /etc/letsencrypt/live/{{ LMS_HOST }}/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/{{ LMS_HOST }}/privkey.pem; {% endif %} - + # Prevent invalid display courseware in IE 10+ with high privacy settings add_header P3P 'CP="Open edX does not have a P3P policy."';