Improve routing between containers
Create user network nginx-internal and use Docker's internal DNS server to resolve containers by hostname.
This commit is contained in:
parent
d9bd3ac145
commit
54de631d29
|
@ -11,6 +11,8 @@
|
|||
docker_container:
|
||||
name: 'jellyfin'
|
||||
image: linuxserver/jellyfin
|
||||
networks:
|
||||
- name: nginx-internal
|
||||
volumes:
|
||||
- "{{ data_folder }}/jellyfin:/config"
|
||||
- "{{ media.tv }}:/data/tv"
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
server {
|
||||
listen 80;
|
||||
server_name "jellyfin.{{ base_domain }}";
|
||||
set $jellyfin {{ server_ip }};
|
||||
#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 }};
|
||||
set $jellyfin jellyfin;
|
||||
|
||||
# Security/XSS Mitigation Headers
|
||||
add_header X-Frame-Options "SAMEORIGIN";
|
||||
|
|
|
@ -58,10 +58,18 @@
|
|||
src: nginx.conf.j2
|
||||
dest: "{{ data_folder }}/nginx/nginx.conf"
|
||||
mode: '0755'
|
||||
- name: create nginx bridge network
|
||||
docker_network:
|
||||
name: nginx-internal
|
||||
attachable: true
|
||||
internal: true
|
||||
state: present
|
||||
- name: run container
|
||||
docker_container:
|
||||
name: 'nginx'
|
||||
image: nginx
|
||||
networks:
|
||||
- name: nginx-internal
|
||||
volumes:
|
||||
- "{{ data_folder }}/nginx/nginx.conf:/etc/nginx/nginx.conf"
|
||||
- "{{ data_folder }}/nginx/{{ base_domain }}.key:/etc/nginx/{{ base_domain }}.key"
|
||||
|
|
|
@ -26,6 +26,7 @@ http {
|
|||
keepalive_timeout 65;
|
||||
|
||||
#gzip on;
|
||||
resolver 127.0.0.11 valid=30;
|
||||
ssl_certificate /etc/nginx/{{ base_domain }}.crt;
|
||||
ssl_certificate_key /etc/nginx/{{ base_domain }}.key;
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
|
|
Loading…
Reference in New Issue