From 9487c231a5f77f99d4fb3c851315a26b74dbb37b Mon Sep 17 00:00:00 2001 From: Patrick Date: Wed, 13 Nov 2024 18:40:36 +0100 Subject: [PATCH] ssl support --- Makefile | 3 +++ nginx | 14 +++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 36ff554..8c1e003 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,9 @@ build: docker save -o $(APP).tar $(APP) 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 + openssl x509 -req -in /etc/ssl/certs/$(APP).csr -CA /root/ca.crt -CAkey ca.key -CAcreateserial -out /etc/ssl/certs/$(APP).crt -days 500 -sha256 cp nginx /etc/nginx/sites-enabled/$(APP) docker load -i $(APP).tar docker run -p 5000:5000 --name $(APP) --restart always -d $(APP) diff --git a/nginx b/nginx index 3819854..6f52b03 100644 --- a/nginx +++ b/nginx @@ -1,10 +1,22 @@ server { listen 80; - server_name _; + server_name jetsearch.com www.jetsearch.com; + + return 301 https://$host$request_uri; +} + +server { + listen 443 ssl; + server_name jetsearch.com www.jetsearch.com; + + ssl_certificate /path/to/your/certificate.crt; + ssl_certificate_key /path/to/your/private.key; location / { proxy_pass http://127.0.0.1:5000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; } } \ No newline at end of file