Last active
June 7, 2020 19:32
-
-
Save codekitchen/2c519eb7572002afab6a5f979cd42913 to your computer and use it in GitHub Desktop.
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 jwilder/nginx-proxy | |
COPY *.conf /etc/nginx/conf.d/ | |
COPY letsencrypt.diff /app/ | |
RUN apt-get update && apt-get install -y \ | |
patch \ | |
&& rm -rf /var/lib/apt/lists/* | |
RUN patch nginx.tmpl letsencrypt.diff |
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
--- nginx.tmpl 2017-12-29 08:56:32.000000000 -0700 | |
+++ nginx.tmpl 2017-12-29 08:56:32.000000000 -0700 | |
@@ -193,7 +193,18 @@ | |
listen [::]:80 {{ $default_server }}; | |
{{ end }} | |
access_log /var/log/nginx/access.log vhost; | |
- return 301 https://$host$request_uri; | |
+ | |
+ location /.well-known/acme-challenge/ { | |
+ auth_basic off; | |
+ allow all; | |
+ root /usr/share/nginx/html; | |
+ try_files $uri =404; | |
+ break; | |
+ } | |
+ | |
+ location / { | |
+ return 301 https://$host$request_uri; | |
+ } | |
} | |
{{ end }} |
I don't remember why I made this a gist, but I'm glad it helped somebody!
This worked for me too. Thanks! :)
I had to comment out the COPY *.conf /etc/nginx/conf.d/
line in the suggested Dockerfile
and also decided to make a docker-compose.yml
:
version: '3.7'
services:
nginx_proxy:
build: .
container_name: nginx_proxy
ports:
- "80:80"
- "443:443"
restart: always
environment:
ENABLE_IPV6: 1
volumes:
- type: bind
source: /var/run/docker.sock
target: /tmp/docker.sock
- type: bind
source: /path/to/letsencrypt/certs
target: /etc/nginx/certs
- type: volume
source: dhparam
target: /etc/nginx/dhparam
- type: bind
source: /path/to/nginx/htpasswd
target: /etc/nginx/htpasswd
- type: bind
source: /path/to/nginx/conf.d
target: /etc/nginx/conf.d
- type: bind
source: /path/to/nginx/vhost.d
target: /etc/nginx/vhost.d
- type: bind
source: /path/to/nginx/html
target: /usr/share/nginx/html
networks:
- custom_bridge_network
volumes:
dhparam:
external:
name: {enter volume ID of dhparam volume created by original nginx_proxy here}
networks:
custom_bridge_network:
external: true
name: custom_bridge_network
Hope it helps anyone.
I made a PR to add this to jwilder/nginx-proxy: nginx-proxy/nginx-proxy#1338
PS @codekitchen You made it because of this: nginx-proxy/acme-companion#299
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for this workaround :)