Enable SSL

This commit is contained in:
Lukáš Kucharczyk 2021-04-26 23:54:10 +02:00
parent 4907cdfd99
commit 765e9e5a47
No known key found for this signature in database
GPG Key ID: 65524498C0196B64
5 changed files with 105 additions and 0 deletions

View File

@ -3,12 +3,23 @@ server {
server_name "jellyfin.{{ base_domain }}"; server_name "jellyfin.{{ base_domain }}";
set $jellyfin {{ server_ip }}; set $jellyfin {{ server_ip }};
#resolver 127.0.0.1 valid=30; #resolver 127.0.0.1 valid=30;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name "jellyfin.{{ base_domain }}";
set $jellyfin {{ server_ip }};
# Security/XSS Mitigation Headers # Security/XSS Mitigation Headers
add_header X-Frame-Options "SAMEORIGIN"; add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block"; add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff"; add_header X-Content-Type-Options "nosniff";
location = / {
return 302 https://$host/web/;
}
location / { location / {
proxy_pass http://$jellyfin:8096; proxy_pass http://$jellyfin:8096;
proxy_set_header Host $host; proxy_set_header Host $host;

View File

@ -0,0 +1,24 @@
-----BEGIN CERTIFICATE-----
MIID8zCCAtugAwIBAgIUPXGk144K0wqfLNwO7MK4g3ddbewwDQYJKoZIhvcNAQEL
BQAwgYgxCzAJBgNVBAYTAkNaMRMwEQYDVQQIDApTb21lLVN0YXRlMQ8wDQYDVQQH
DAZQcmFndWUxGDAWBgNVBAoMD0t1Y2hhcmN6eWsgTHRkLjEUMBIGA1UEAwwLKi5k
ZXYubG9jYWwxIzAhBgkqhkiG9w0BCQEWFGx1a2FzQGt1Y2hhcmN6eWsueHl6MB4X
DTIxMDQyNjIxMDA1OFoXDTMxMDQyNDIxMDA1OFowgYgxCzAJBgNVBAYTAkNaMRMw
EQYDVQQIDApTb21lLVN0YXRlMQ8wDQYDVQQHDAZQcmFndWUxGDAWBgNVBAoMD0t1
Y2hhcmN6eWsgTHRkLjEUMBIGA1UEAwwLKi5kZ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CCyOrqXZrjzmbvUlSlwMSOX
NtgPmRmm9A1/vXTkzkx0L2pK7yacJMoztTK6z1IbtwDko7tNcu0f2jmybcVZwcU3
Dfq4lHCSHC37HKyVbm13c20xZ4P546YSWWxSdrmLBSPUHvHwcW43wtTtAoGBAMOb
yAqYiRX9dQrOokU2JpJWcF6cXhaOsYEcXv5AsZxLfVxyEEd+8L44R/Wh4E2ipziK
LqildY9bZWpFH9A2ZzMric0FwXmqfjrNpjRXCC4i0ZfM5pkAx1uaEwk0lVvdZhGA
Bj3ZQtVVgmd+a/tR/oR+m6Tw3csZBCqA7H6rRSxJAoGBAIFd0PRdKm5+mUc575GQ
sxVznovODCdRyOAeD9IKyCcpMo8zB9uiNDRPG/sUebnowC3v7EeCYUUHlUDtsSjc
BZyasg71mrZElWg2mDonw/J9fcrEPGrh59wmqk49MLvzB0An/eP+gGK3RFgbijkN
EZcByagGNGdICcaaxr+RhgcU
-----END PRIVATE KEY-----

View File

@ -5,6 +5,13 @@
mode: '0755' mode: '0755'
loop: loop:
- "{{ nginx_confd_folder }}" - "{{ nginx_confd_folder }}"
- name: copy certificates
copy:
src: "{{ item }}"
dest: "{{ data_folder }}/nginx"
loop:
- localhost.key
- localhost.crt
- name: copy .conf file - name: copy .conf file
template: template:
src: nginx.conf.j2 src: nginx.conf.j2
@ -16,9 +23,12 @@
image: nginx image: nginx
volumes: volumes:
- "{{ data_folder }}/nginx/nginx.conf:/etc/nginx/nginx.conf" - "{{ data_folder }}/nginx/nginx.conf:/etc/nginx/nginx.conf"
- "{{ data_folder }}/nginx/localhost.crt:/etc/nginx/localhost.crt"
- "{{ data_folder }}/nginx/localhost.key:/etc/nginx/localhost.key"
- "{{ nginx_confd_folder }}:/etc/nginx/conf.d" - "{{ nginx_confd_folder }}:/etc/nginx/conf.d"
ports: ports:
- "80:80" - "80:80"
- "443:443"
env: env:
NGINX_HOST: "{{ base_domain }}" NGINX_HOST: "{{ base_domain }}"
NGINX_PORT: '80' NGINX_PORT: '80'

View File

@ -0,0 +1,32 @@
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
ssl_certificate /etc/nginx/localhost.crt;
ssl_certificate_key /etc/nginx/localhost.key;
include /etc/nginx/conf.d/*.conf;
}