Skip to content

Instantly share code, notes, and snippets.

@meriororen
Created September 3, 2020 03:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meriororen/c41c4f66538ee36254fd998deb0d6cf5 to your computer and use it in GitHub Desktop.
Save meriororen/c41c4f66538ee36254fd998deb0d6cf5 to your computer and use it in GitHub Desktop.
Setup ssl termination for local dockerized environment
FROM nginx:1.19
COPY *.pem /etc/nginx/certs/
COPY nginx.conf /etc/nginx/nginx.conf
EXPOSE 443
ENTRYPOINT ["nginx", "-g", "daemon off;"]
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
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;
}
}
}
@meriororen
Copy link
Author

the related dockerized nginx is called "appsweb" serving at 80, we want to have it accessed with ssl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment