From 23cbd8cf8311d0a0a9929ab3d515d2b8fb22837b Mon Sep 17 00:00:00 2001 From: marcel-dempers Date: Fri, 4 Sep 2020 10:24:31 +1000 Subject: [PATCH] wip --- security/letsencrypt/introduction/dockerfile | 3 ++ security/letsencrypt/introduction/nginx.conf | 44 ++++++++++++++++++++ security/letsencrypt/readme.md | 10 +++++ 3 files changed, 57 insertions(+) create mode 100644 security/letsencrypt/introduction/dockerfile create mode 100644 security/letsencrypt/introduction/nginx.conf create mode 100644 security/letsencrypt/readme.md diff --git a/security/letsencrypt/introduction/dockerfile b/security/letsencrypt/introduction/dockerfile new file mode 100644 index 0000000..bc3638b --- /dev/null +++ b/security/letsencrypt/introduction/dockerfile @@ -0,0 +1,3 @@ +FROM debian:buster + +RUN apt-get update -y && apt-get install -y certbot \ No newline at end of file diff --git a/security/letsencrypt/introduction/nginx.conf b/security/letsencrypt/introduction/nginx.conf new file mode 100644 index 0000000..7ae4cfe --- /dev/null +++ b/security/letsencrypt/introduction/nginx.conf @@ -0,0 +1,44 @@ + +user nginx; +worker_processes 1; + +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; + +events { + worker_connections 1024; +} + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + sendfile on; + keepalive_timeout 65; + + server { + listen 80; + + if ($request_uri ~* "([^/]*$)" ) { + set $last_path_component $1; + } + + location /.well-known/acme-challenge/ { + root /letsencrypt/; + try_files $last_path_component $uri/ =404; + } + + location / { + gzip off; + root /usr/share/nginx/html/; + index index.html; + } + + } + +} diff --git a/security/letsencrypt/readme.md b/security/letsencrypt/readme.md new file mode 100644 index 0000000..9f30e3e --- /dev/null +++ b/security/letsencrypt/readme.md @@ -0,0 +1,10 @@ + + +``` +docker run -it -v ${PWD}:/work -w /work nginx bash +``` + +``` +docker run -it -v ${PWD}/nginx.conf:/etc/nginx/nginx.conf -p 80:80 nginx +``` +