From 703b205bab34edd0d3a39ae6a29b42305ed831c2 Mon Sep 17 00:00:00 2001 From: MohammadMahdi Date: Fri, 13 Oct 2023 02:49:54 +0330 Subject: [PATCH] Add ssl support. --- nginx/Dockerfile | 4 +++- nginx/nginx.conf | 11 ++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/nginx/Dockerfile b/nginx/Dockerfile index 4c49d2e..cd4928e 100644 --- a/nginx/Dockerfile +++ b/nginx/Dockerfile @@ -1,4 +1,6 @@ FROM nginx:alpine RUN rm /etc/nginx/conf.d/default.conf -COPY nginx.conf /etc/nginx/conf.d \ No newline at end of file +COPY nginx.conf /etc/nginx/conf.d +COPY fullchain.pem /etc/nginx/ +COPY privkey.pem /etc/nginx/ \ No newline at end of file diff --git a/nginx/nginx.conf b/nginx/nginx.conf index fda324d..ce5abaf 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -5,6 +5,15 @@ upstream web { server { listen 80; server_name foodinol.ir www.foodinol.ir; + return 301 https://$host$request_uri; +} + +server { + listen 443 ssl; + server_name foodinol.ir www.foodinol.ir; + + ssl_certificate /etc/nginx/fullchain.pem; + ssl_certificate_key /etc/nginx/privkey.pem; location / { proxy_pass http://web; @@ -17,4 +26,4 @@ server { location /static/ { alias /web/staticfiles/; } -} \ No newline at end of file +}