From 8aeb2237ad74176f4d479e3a9663cae1327a4705 Mon Sep 17 00:00:00 2001 From: Wakibi Chris Date: Wed, 22 Nov 2023 16:04:44 +0300 Subject: [PATCH] Add default server to nginx configs --- config/nginx/django.conf.ctmpl | 9 ++++++++- config/nginx/django_https.ctmpl | 14 +++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/config/nginx/django.conf.ctmpl b/config/nginx/django.conf.ctmpl index 7dfea14ea..56a889901 100644 --- a/config/nginx/django.conf.ctmpl +++ b/config/nginx/django.conf.ctmpl @@ -26,10 +26,17 @@ upstream green { {{ end }} } +server { + listen 80 default_server; + listen [::]:80 default_server; + server_name _; + return 444; +} + server { listen 80; - server_name devinit.org www.devinit.org; + server_name devinit.org www.devinit.org dev.devinit.org; client_max_body_size 100M; diff --git a/config/nginx/django_https.ctmpl b/config/nginx/django_https.ctmpl index 15a370ecd..922a45dfd 100644 --- a/config/nginx/django_https.ctmpl +++ b/config/nginx/django_https.ctmpl @@ -1,3 +1,15 @@ +server { + listen [::]:443 ssl default_server; + listen 443 ssl default_server; + server_name _; + # Use below to avoid SSL errors on non-existent domains + set $empty ""; + ssl_ciphers aNULL; + ssl_certificate data:$empty; + ssl_certificate_key data:$empty; + return 444; +} + server { listen 443 ssl; ssl on; @@ -8,7 +20,7 @@ server { ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4; ssl_prefer_server_ciphers on; - server_name www.devinit.org devinit.org; + server_name www.devinit.org devinit.org dev.devinit.org; client_max_body_size 100M;