diff --git a/Dockerfile b/Dockerfile index 0be2915..c0e80d5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -50,13 +50,15 @@ RUN bash -xc "chown -R jekyll: /srv/jekyll && \ RUN ls -al /data /data/img -FROM nginx:1.13-alpine + +FROM nginx:alpine # Disable access logs (if needed, can be fetched from the reverse proxy) # and also make sure hidden files are not served by NGINX # TODO the latter doesn't work currently RUN sed -i 's/access_log.*/access_log off;/' /etc/nginx/nginx.conf && \ - sed -i 's/^}/ location ~ \^\/(\\\.) { internal; }\n}/' /etc/nginx/conf.d/default.conf && \ sed -i 's/^}/ application\/rss+xml rss;\n application\/atom+xml;\n}/' /etc/nginx/mime.types +COPY docker/nginx/conf.d/default.conf /etc/nginx/conf.d/ + COPY --from=builder /data /usr/share/nginx/html diff --git a/docker/nginx/conf.d/default.conf b/docker/nginx/conf.d/default.conf new file mode 100644 index 0000000..d0eae3a --- /dev/null +++ b/docker/nginx/conf.d/default.conf @@ -0,0 +1,25 @@ +server { + listen 80; + server_name localhost; + + access_log off; + + root /usr/share/nginx/html; + error_page 404 /404.html; + + location / { + index index.html index.htm; + } + + location ~ ^/(blog|press) { + error_page 404 /$1/404.html; + } + + error_page 404 /404.html; + error_page 500 502 503 504 /50x.html; + + location ~ /\. { + deny all; + } +} +