From 81bca59152981925b263f48756ca4a39c75f9f75 Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Sun, 19 Sep 2021 00:52:29 +0500 Subject: [PATCH] Remove unnecessary templates --- tasks/install.yml | 2 +- templates/listing.conf | 27 ------------------- templates/origin.conf | 53 ------------------------------------ templates/proxy.conf | 59 ----------------------------------------- templates/raw.conf | 1 - templates/redirect.conf | 22 --------------- 6 files changed, 1 insertion(+), 163 deletions(-) delete mode 100644 templates/listing.conf delete mode 100644 templates/origin.conf delete mode 100644 templates/proxy.conf delete mode 100644 templates/raw.conf delete mode 100644 templates/redirect.conf diff --git a/tasks/install.yml b/tasks/install.yml index 172a79b..130ce3c 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -63,7 +63,7 @@ - name: Add Nginx sites notify: nginx | Restart Nginx template: - src: 'templates/nginx/{{ item.type }}.conf' + content: '{{ item.content }}' dest: '{{ nginx__available_dir }}/{{ item.domain }}.conf' mode: 'u=rw,go=r' owner: root diff --git a/templates/listing.conf b/templates/listing.conf deleted file mode 100644 index ec93030..0000000 --- a/templates/listing.conf +++ /dev/null @@ -1,27 +0,0 @@ -server { - listen 80; - listen [::]:80; - - server_name {{ item.domain }}; - - return 301 https://$host$request_uri; -} - -server { - listen 443 ssl; - listen [::]:443 ssl; - - server_name {{ item.domain }}; - - ssl_certificate {{ item.cert }}; - ssl_certificate_key {{ item.key }}; - - include {{ item.ssl_conf }}; - - root {{ item.root }}; - - try_files $uri $uri/ =404; - - charset utf-8; - autoindex on; -} diff --git a/templates/origin.conf b/templates/origin.conf deleted file mode 100644 index f891d7e..0000000 --- a/templates/origin.conf +++ /dev/null @@ -1,53 +0,0 @@ -server { - listen 80; - listen [::]:80; - - server_name {{ item.domain }}; - - return 301 https://$host$request_uri; -} - -server { - listen 443 ssl; - listen [::]:443 ssl; - - server_name {{ item.domain }}; - - ssl_certificate {{ item.cert }}; - ssl_certificate_key {{ item.key }}; - - include {{ item.ssl_conf }}; - - root {{ item.root }}; - - try_files $uri/index.html $uri @origin; - - location @origin { - proxy_cache_bypass $http_upgrade; - proxy_http_version 1.1; - proxy_redirect off; - -{% if item.external %} - proxy_set_header Connection "upgrade"; - proxy_set_header HOST $host; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header X-Forwarded-For $remote_addr; - proxy_set_header X-Forwarded-Host $host; - proxy_set_header X-Forwarded-Port $server_port; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Real-IP $remote_addr; -{% else %} - proxy_set_header Connection "upgrade"; - proxy_set_header HOST $http_host; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header X-Forwarded-For $http_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; -{% endif %} - - proxy_pass http://{{ item.upstream }}; - } - - error_page 500 502 503 504 /500.html; - client_max_body_size 4G; - keepalive_timeout 10; -} diff --git a/templates/proxy.conf b/templates/proxy.conf deleted file mode 100644 index 1071fef..0000000 --- a/templates/proxy.conf +++ /dev/null @@ -1,59 +0,0 @@ -server { - listen 80; - listen [::]:80; - - server_name {{ item.domain }}; - - return 301 https://$host$request_uri; -} - -server { - listen 443 ssl; - listen [::]:443 ssl; - - server_name {{ item.domain }}; - - ssl_certificate {{ item.cert }}; - ssl_certificate_key {{ item.key }}; - - include {{ item.ssl_conf }}; - - ssl_verify_client optional; - ssl_client_certificate {{ item.clnt_ca }}; - - proxy_cache_bypass $http_upgrade; - proxy_http_version 1.1; - proxy_redirect off; - - proxy_set_header Connection "upgrade"; - proxy_set_header HOST $host; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header X-Forwarded-For $remote_addr; - proxy_set_header X-Forwarded-Host $host; - proxy_set_header X-Forwarded-Port $server_port; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Real-IP $remote_addr; - - location / { - recursive_error_pages on; - - error_page 418 = @no_crt; - error_page 419 = @with_crt; - - if ($ssl_client_verify != SUCCESS) { - return 418; - } - - if ($ssl_client_verify = SUCCESS) { - return 419; - } - } - - location @no_crt { - proxy_pass https://{{ item.no_crt }}; - } - - location @with_crt { - proxy_pass https://{{ item.with_crt }}; - } -} diff --git a/templates/raw.conf b/templates/raw.conf deleted file mode 100644 index 37774b9..0000000 --- a/templates/raw.conf +++ /dev/null @@ -1 +0,0 @@ -{{ item.content }} diff --git a/templates/redirect.conf b/templates/redirect.conf deleted file mode 100644 index 52d0a69..0000000 --- a/templates/redirect.conf +++ /dev/null @@ -1,22 +0,0 @@ -server { - listen 80; - listen [::]:80; - - server_name {{ item.domain }}; - - return 301 https://$host$request_uri; -} - -server { - listen 443 ssl; - listen [::]:443 ssl; - - server_name {{ item.domain }}; - - ssl_certificate {{ item.cert }}; - ssl_certificate_key {{ item.key }}; - - include {{ item.ssl_conf }}; - - return 301 https://{{ item.redir_to }}$request_uri; -}