diff --git a/Makefile b/Makefile index 68888f3..801566e 100644 --- a/Makefile +++ b/Makefile @@ -7,8 +7,10 @@ build: install: openssl genrsa -out /etc/ssl/private/$(APP).key 2048 - openssl req -new -key /etc/ssl/private/$(APP).key -out /etc/ssl/certs/$(APP).csr -subj '/C=CH/ST=Zurich/L=Zurich/O=InterstellarNet/OU=NONE/CN=$(DOMAIN)' + openssl req -new -key /etc/ssl/private/$(APP).key -out /etc/ssl/certs/$(APP).csr -config openssl.cnf openssl x509 -req -in /etc/ssl/certs/$(APP).csr -CA /root/ca.crt -CAkey /root/ca.key -CAcreateserial -out /etc/ssl/certs/$(APP).crt -days 500 -sha256 - cp nginx /etc/nginx/sites-enabled/$(APP) + cp nginx.cnf /etc/nginx/sites-enabled/$(APP) + echo -e "\nzone \"jetsearch.com\" {\n type master;\n file \"/etc/bind/db.jetsearch.com\";\n};" | tee -a /etc/bind/named.conf.local + cp zonefile.cnf /etc/bind/db.$(DOMAIN) docker load -i $(APP).tar docker run -p 5000:5000 --name $(APP) --restart always -d $(APP) diff --git a/nginx b/nginx.cnf similarity index 55% rename from nginx rename to nginx.cnf index f39c19a..f021982 100644 --- a/nginx +++ b/nginx.cnf @@ -2,7 +2,14 @@ server { listen 80; server_name jetsearch.com; - return 301 https://$host$request_uri; + return 301 https://www.jetsearch.com$request_uri; +} + +server { + listen 80; + server_name www.jetsearch.com; + + return 301 https://www.jetsearch.com$request_uri; } server { @@ -12,6 +19,16 @@ server { ssl_certificate /etc/ssl/certs/jet-search.crt; ssl_certificate_key /etc/ssl/private/jet-search.key; + return 301 https://www.jetsearch.com$request_uri; +} + +server { + listen 443 ssl; + server_name www.jetsearch.com; + + ssl_certificate /etc/ssl/certs/jet-search.crt; + ssl_certificate_key /etc/ssl/private/jet-search.key; + location / { proxy_pass http://127.0.0.1:5000; proxy_set_header Host $host; diff --git a/openssl.cnf b/openssl.cnf new file mode 100644 index 0000000..a04188f --- /dev/null +++ b/openssl.cnf @@ -0,0 +1,20 @@ +[ req ] +default_bits = 2048 +distinguished_name = req_distinguished_name +req_extensions = req_ext +prompt = no + +[ req_distinguished_name ] +C = CH +ST = Zurich +L = Zurich +O = InterstellarNet +OU = NONE +CN = jetsearch.com + +[ req_ext ] +subjectAltName = @alt_names + +[ alt_names ] +DNS.1 = jetsearch.com +DNS.2 = www.jetsearch.com \ No newline at end of file diff --git a/zonefile.cnf b/zonefile.cnf new file mode 100644 index 0000000..74334cb --- /dev/null +++ b/zonefile.cnf @@ -0,0 +1,12 @@ +$TTL 604800 +@ IN SOA ns.jetsearch.com. admin.jetsearch.com. ( + 2 + 604800 + 86400 + 2419200 + 604800 ) +; +@ IN NS ns.jetsearch.com. +ns IN A 192.168.1.1 +@ IN A 192.168.1.1 +www IN A 192.168.1.1 \ No newline at end of file