Skip to content

Commit

Permalink
feat(nginx): add nginx v1.18 image
Browse files Browse the repository at this point in the history
  • Loading branch information
damienwebdev committed Jun 1, 2020
1 parent 357a534 commit 01ddbde
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 0 deletions.
14 changes: 14 additions & 0 deletions nginx/1.18/alpine-develop/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM nginx:1.18-alpine

MAINTAINER Damien Retzinger <[email protected]>

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
19 changes: 19 additions & 0 deletions nginx/1.18/alpine-develop/conf/default.conf
Original file line number Diff line number Diff line change
@@ -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;
}
27 changes: 27 additions & 0 deletions nginx/1.18/alpine-develop/conf/nginx.conf
Original file line number Diff line number Diff line change
@@ -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;
}
15 changes: 15 additions & 0 deletions nginx/1.18/alpine-develop/conf/prod.sample.conf
Original file line number Diff line number Diff line change
@@ -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;
# }

0 comments on commit 01ddbde

Please sign in to comment.