From ecc747f9584f1bb0b321ec7f66d38541ddbed1e7 Mon Sep 17 00:00:00 2001 From: juhomakkonen Date: Thu, 21 Mar 2024 12:52:46 +0200 Subject: [PATCH] Update Docker & nginx settings to allow secure connection --- .gitignore | 1 + Dockerfile | 6 +++++- nginx.conf | 4 +++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 747b4f30..b59a358f 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ .env.production.local /ssl +/sertit .prettierrc /dist diff --git a/Dockerfile b/Dockerfile index b615b2e9..fbdffa1e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,11 +17,15 @@ FROM nginx:alpine # Copy nginx conf file COPY nginx.conf /etc/nginx/conf.d/default.conf +# Copy SSL sertificates +COPY ./sertit/star_turku_fi.crt /etc/nginx/star_turku_fi.crt +COPY ./sertit/star_turku_fi.key /etc/nginx/star_turku_fi.key + # Copy the built React app to Nginx's web server directory COPY --from=build /app/dist /usr/share/nginx/html # Expose port 80 for the Nginx server -EXPOSE 80 +EXPOSE 443 # Start Nginx when the container runs CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/nginx.conf b/nginx.conf index 4d044eaf..60c71329 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,5 +1,7 @@ server { - listen 80; + listen 443 ssl; + ssl_certificate /etc/nginx/star_turku_fi.crt; + ssl_certificate_key /etc/nginx/star_turku_fi.key; server_name liikkumistesti.turku.fi; root /usr/share/nginx/html; index index.html;