From 01ddbdede3cc972ed2b22b11cd7481d4d2ca9b43 Mon Sep 17 00:00:00 2001 From: Damien Retzinger Date: Sun, 31 May 2020 21:06:44 -0400 Subject: [PATCH] feat(nginx): add nginx v1.18 image --- nginx/1.18/alpine-develop/Dockerfile | 14 ++++++++++ nginx/1.18/alpine-develop/conf/default.conf | 19 +++++++++++++ nginx/1.18/alpine-develop/conf/nginx.conf | 27 +++++++++++++++++++ .../1.18/alpine-develop/conf/prod.sample.conf | 15 +++++++++++ 4 files changed, 75 insertions(+) create mode 100644 nginx/1.18/alpine-develop/Dockerfile create mode 100644 nginx/1.18/alpine-develop/conf/default.conf create mode 100644 nginx/1.18/alpine-develop/conf/nginx.conf create mode 100644 nginx/1.18/alpine-develop/conf/prod.sample.conf diff --git a/nginx/1.18/alpine-develop/Dockerfile b/nginx/1.18/alpine-develop/Dockerfile new file mode 100644 index 0000000..c8f5c7f --- /dev/null +++ b/nginx/1.18/alpine-develop/Dockerfile @@ -0,0 +1,14 @@ +FROM nginx:1.18-alpine + +MAINTAINER Damien Retzinger + +RUN apk update && apk add openssl +RUN mkdir /etc/nginx/certs \ + && echo -e "\n\n\n\n\n\n\n" | openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/certs/nginx.key -out /etc/nginx/certs/nginx.crt + +COPY ./conf/nginx.conf /etc/nginx/ +COPY ./conf/default.conf /etc/nginx/conf.d/ + +EXPOSE 8443 + +WORKDIR /var/www/html diff --git a/nginx/1.18/alpine-develop/conf/default.conf b/nginx/1.18/alpine-develop/conf/default.conf new file mode 100644 index 0000000..168fa13 --- /dev/null +++ b/nginx/1.18/alpine-develop/conf/default.conf @@ -0,0 +1,19 @@ +upstream fastcgi_backend { + server magento2:9000; +} + +server { + listen 8000; + return 301 https://$host$request_uri; +} + +server { + listen 8443 ssl; + + ssl_certificate /etc/nginx/certs/nginx.crt; + ssl_certificate_key /etc/nginx/certs/nginx.key; + + set $MAGE_ROOT /var/www/html; + + include /var/www/html/nginx[.]conf; +} \ No newline at end of file diff --git a/nginx/1.18/alpine-develop/conf/nginx.conf b/nginx/1.18/alpine-develop/conf/nginx.conf new file mode 100644 index 0000000..3a0ebf1 --- /dev/null +++ b/nginx/1.18/alpine-develop/conf/nginx.conf @@ -0,0 +1,27 @@ +worker_processes 2; + +error_log /var/log/nginx/error.log debug; + +events { + +} + +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 60; + + gzip on; + + include /etc/nginx/conf.d/*.conf; +} \ No newline at end of file diff --git a/nginx/1.18/alpine-develop/conf/prod.sample.conf b/nginx/1.18/alpine-develop/conf/prod.sample.conf new file mode 100644 index 0000000..719fc2b --- /dev/null +++ b/nginx/1.18/alpine-develop/conf/prod.sample.conf @@ -0,0 +1,15 @@ +## This ngninx configuration should serve as an example for a production configuration of nginx. +## Do note that this configuration only serves non-encrypted connections. This is intentional; +## traffic within the DMZ should not need to be encrypted unless absolutely required. + +server { + listen 8000; + + set $MAGE_ROOT /var/www/html; + + include /var/www/html/nginx[.]conf; +} + +# upstream fastcgi_backend { +# server magento2:9001; +# } \ No newline at end of file