mirror of
https://github.com/ChristianLight/tutor.git
synced 2024-06-25 16:32:35 +00:00
http redirects to http https redirects to https and the life of servers becomes more simple
71 lines
2.1 KiB
Plaintext
71 lines
2.1 KiB
Plaintext
server {
|
|
listen 80;
|
|
server_name {{ LMS_HOST }} preview.{{ LMS_HOST }} {{ CMS_HOST }};
|
|
|
|
server_tokens off;
|
|
location / {
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_set_header X-Forwarded-Port $server_port;
|
|
proxy_set_header X-Forwarded-For $remote_addr;
|
|
proxy_set_header Host $http_host;
|
|
proxy_redirect off;
|
|
proxy_pass http://localhost:{{ NGINX_HTTP_PORT }};
|
|
}
|
|
}
|
|
|
|
{% if ACTIVATE_HTTPS %}
|
|
server {
|
|
listen 443 ssl;
|
|
server_name {{ LMS_HOST }} preview.{{ LMS_HOST }} {{ CMS_HOST }};
|
|
|
|
ssl_certificate /etc/letsencrypt/live/{{ LMS_HOST }}/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/{{ LMS_HOST }}/privkey.pem;
|
|
|
|
server_tokens off;
|
|
location / {
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_set_header X-Forwarded-Port $server_port;
|
|
proxy_set_header X-Forwarded-For $remote_addr;
|
|
proxy_set_header Host $http_host;
|
|
proxy_redirect off;
|
|
proxy_pass http://localhost:{{ NGINX_HTTPS_PORT }};
|
|
}
|
|
}
|
|
{% endif %}
|
|
|
|
{% if ACTIVATE_NOTES %}
|
|
server {
|
|
listen 80;
|
|
server_name notes.{{ LMS_HOST }};
|
|
|
|
server_tokens off;
|
|
location / {
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_set_header X-Forwarded-Port $server_port;
|
|
proxy_set_header X-Forwarded-For $remote_addr;
|
|
proxy_set_header Host $http_host;
|
|
proxy_redirect off;
|
|
proxy_pass http://localhost:{{ NGINX_HTTP_PORT }};
|
|
}
|
|
}
|
|
{% if ACTIVATE_HTTPS %}
|
|
server {
|
|
listen 443 ssl;
|
|
server_name notes.{{ LMS_HOST }};
|
|
|
|
ssl_certificate /etc/letsencrypt/live/notes.{{ LMS_HOST }}/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/notes.{{ LMS_HOST }}/privkey.pem;
|
|
|
|
server_tokens off;
|
|
location / {
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_set_header X-Forwarded-Port $server_port;
|
|
proxy_set_header X-Forwarded-For $remote_addr;
|
|
proxy_set_header Host $http_host;
|
|
proxy_redirect off;
|
|
proxy_pass http://localhost:{{ NGINX_HTTPS_PORT }};
|
|
}
|
|
}
|
|
{% endif %}
|
|
{% endif %}
|