Created
September 3, 2020 03:44
-
-
Save meriororen/c41c4f66538ee36254fd998deb0d6cf5 to your computer and use it in GitHub Desktop.
Setup ssl termination for local dockerized environment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM nginx:1.19 | |
COPY *.pem /etc/nginx/certs/ | |
COPY nginx.conf /etc/nginx/nginx.conf | |
EXPOSE 443 | |
ENTRYPOINT ["nginx", "-g", "daemon off;"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: | |
docker build -t nginx-proxy . | |
docker stop proxy; docker rm proxy; | |
docker run -dt --name proxy --link appsweb:appsweb -p 443:443 nginx-proxy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
worker_processes auto; | |
events { | |
worker_connections 8000; | |
multi_accept on; | |
} | |
http { | |
server { | |
listen 443 ssl; | |
server_name bakungbakung.local; | |
# this is generated with mkcert (google it) | |
ssl_certificate /etc/nginx/certs/bakungbakung.local.pem; | |
ssl_certificate_key /etc/nginx/certs/bakungbakung.local-key.pem; | |
location / { | |
proxy_pass http://appsweb/; | |
error_log /var/log/error_bakung.log; | |
} | |
} | |
server { | |
listen 443 ssl; | |
server_name tempekucing.local; | |
ssl_certificate /etc/nginx/certs/tempekucing.local.pem; | |
ssl_certificate_key /etc/nginx/certs/tempekucing.local-key.pem; | |
location / { | |
proxy_pass http://appsweb/; | |
error_log /var/log/error_bakung.log; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the related dockerized nginx is called "appsweb" serving at 80, we want to have it accessed with ssl