From 372bf3685b8d59bb5764a6d058b72e0081538cfe Mon Sep 17 00:00:00 2001 From: Rutger Hartog Date: Wed, 7 Jul 2021 11:23:00 +0200 Subject: [PATCH] added custom nginx config file --- .docker/default.conf | 21 +++++++++++++++++++++ Dockerfile | 6 +++++- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 .docker/default.conf diff --git a/.docker/default.conf b/.docker/default.conf new file mode 100644 index 00000000..9d3a7b22 --- /dev/null +++ b/.docker/default.conf @@ -0,0 +1,21 @@ +server { + listen 80; + listen [::]:80; + server_name localhost; + + location / { + root /usr/share/nginx/html; + index index.html; + add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; font-src data: 'self'"; + add_header X-XSS-Protection "1; mode=block"; + add_header X-Frame-Options "DENY"; + add_header X-Content-Type-Options nosniff; + add_header Referrer-Policy "strict-origin"; + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } + +} diff --git a/Dockerfile b/Dockerfile index 9ed3ffe8..fbf5a425 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,7 @@ -FROM alpine:nginx +FROM nginx:stable-alpine +# Copy the contents of the repo to the container COPY . /usr/share/nginx/html + +# Move the customized nginx config file to the nginx folder +RUN mv /usr/share/nginx/html/.docker/default.conf /etc/nginx/conf.d/default.conf