Code Monkey home page Code Monkey logo

nginx-proxy-letsencrypt's Introduction

Development efforts have moved to the docker-letsencrypt-nginx-proxy-companion project because docker-letsencrypt-nginx-proxy-companion doesn't require a fork of nginx-proxy in order to register Let's Encrypt certificates.

Currently, this project is unsupported. Contact [email protected] if you want to take over support of this project.

nginx 1.9.6 License MIT Build

nginx-proxy sets up a container running nginx and docker-gen. docker-gen generates reverse proxy configs for nginx and reloads nginx when containers are started and stopped.

See Automated Nginx Reverse Proxy for Docker for why you might want to use this.

nginx-proxy-letsencrypt is a fork of nginx-proxy which adds Let's Encrypt support. Let's Encrypt allows multiple virtual hosts to have TLS certificates automatically created and renewed! The reason the jwilder/nginx-proxy was forked is because it seemed unlikely that the specific Let's Encrypt use case world be added to the more generic nginx-proxy project and the Let's Encrypt client does add some storage overhead. See pull request for details about fork. See Let's Encrypt section for configuration details.

Usage

To run it:

$ docker run -d -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock:ro dmp1ce/nginx-proxy-letsencrypt

Then start any containers you want proxied with an env var VIRTUAL_HOST=subdomain.youdomain.com

$ docker run -e VIRTUAL_HOST=foo.bar.com  ...

The containers being proxied must expose the port to be proxied, either by using the EXPOSE directive in their Dockerfile or by using the --expose flag to docker run or docker create.

Provided your DNS is setup to forward foo.bar.com to the a host running nginx-proxy, the request will be routed to a container with the VIRTUAL_HOST env var set.

Multiple Ports

If your container exposes multiple ports, nginx-proxy will default to the service running on port 80. If you need to specify a different port, you can set a VIRTUAL_PORT env var to select a different one. If your container only exposes one port and it has a VIRTUAL_HOST env var set, that port will be selected.

Multiple Hosts

If you need to support multiple virtual hosts for a container, you can separate each entry with commas. For example, foo.bar.com,baz.bar.com,bar.com and each host will be setup the same.

Wildcard Hosts

You can also use wildcards at the beginning and the end of host name, like *.bar.com or foo.bar.*. Or even a regular expression, which can be very useful in conjunction with a wildcard DNS service like xip.io, using ~^foo\.bar\..*\.xip\.io will match foo.bar.127.0.0.1.xip.io, foo.bar.10.0.2.2.xip.io and all other given IPs. More information about this topic can be found in the nginx documentation about server_names.

SSL Backends

If you would like to connect to your backend using HTTPS instead of HTTP, set VIRTUAL_PROTO=https on the backend container.

Default Host

To set the default host for nginx use the env var DEFAULT_HOST=foo.bar.com for example

$ docker run -d -p 80:80 -e DEFAULT_HOST=foo.bar.com -v /var/run/docker.sock:/tmp/docker.sock:ro dmp1ce/nginx-proxy-letsencrypt

Separate Containers

nginx-proxy can also be run as two separate containers using the jwilder/docker-gen image and the official nginx image.

You may want to do this to prevent having the docker socket bound to a publicly exposed container service.

To run nginx proxy as a separate container you'll need to have nginx.tmpl on your host system.

First start nginx with a volume:

$ docker run -d -p 80:80 --name nginx -v /tmp/nginx:/etc/nginx/conf.d -t nginx

Then start the docker-gen container with the shared volume and template:

$ docker run --volumes-from nginx \
    -v /var/run/docker.sock:/tmp/docker.sock:ro \
    -v $(pwd):/etc/docker-gen/templates \
    -t jwilder/docker-gen -notify-sighup nginx -watch -only-exposed /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf

Finally, start your containers with VIRTUAL_HOST environment variables.

$ docker run -e VIRTUAL_HOST=foo.bar.com  ...

SSL Support

SSL is supported using single host, wildcard and SNI certificates using naming conventions for certificates or optionally specifying a cert name (for SNI) as an environment variable.

To enable SSL:

$ docker run -d -p 80:80 -p 443:443 -v /path/to/certs:/etc/nginx/certs -v /var/run/docker.sock:/tmp/docker.sock:ro dmp1ce/nginx-proxy-letsencrypt

The contents of /path/to/certs should contain the certificates and private keys for any virtual hosts in use. The certificate and keys should be named after the virtual host with a .crt and .key extension. For example, a container with VIRTUAL_HOST=foo.bar.com should have a foo.bar.com.crt and foo.bar.com.key file in the certs directory.

Diffie-Hellman Groups

If you have Diffie-Hellman groups enabled, the files should be named after the virtual host with a dhparam suffix and .pem extension. For example, a container with VIRTUAL_HOST=foo.bar.com should have a foo.bar.com.dhparam.pem file in the certs directory.

Wildcard Certificates

Wildcard certificates and keys should be named after the domain name with a .crt and .key extension. For example VIRTUAL_HOST=foo.bar.com would use cert name bar.com.crt and bar.com.key.

SNI

If your certificate(s) supports multiple domain names, you can start a container with CERT_NAME=<name> to identify the certificate to be used. For example, a certificate for *.foo.com and *.bar.com could be named shared.crt and shared.key. A container running with VIRTUAL_HOST=foo.bar.com and CERT_NAME=shared will then use this shared cert.

How SSL Support Works

The SSL cipher configuration is based on mozilla nginx intermediate profile which should provide compatibility with clients back to Firefox 1, Chrome 1, IE 7, Opera 5, Safari 1, Windows XP IE8, Android 2.3, Java 7. The configuration also enables HSTS, and SSL session caches.

The behavior for the proxy when port 80 and 443 are exposed is as follows:

  • If a container has a usable cert, port 80 will redirect to 443 for that container so that HTTPS is always preferred when available.
  • If the container does not have a usable cert, a 503 will be returned.

Note that in the latter case, a browser may get an connection error as no certificate is available to establish a connection. A self-signed or generic cert named default.crt and default.key will allow a client browser to make a SSL connection (likely w/ a warning) and subsequently receive a 503.

Let's Encrypt

Use the Let's Encrypt service to automatically create a valid certificate for a virtual host.

Set the following environment variables to enable Let's Encrypt support for a container being proxied.

  • LETSENCRYPT_HOST
  • LETSENCRYPT_EMAIL

The LETSENCRYPT_HOST variable most likely needs to be the same as the VIRTUAL_HOST variable and must be publicly reachable domains. Specify multiple hosts with a comma delimiter.

For example

$ docker run -d -p 80:80 \
    -e VIRTUAL_HOST="foo.bar.com,bar.com" \
    -e LETSENCRYPT_HOST="foo.bar.com,bar.com" \
    -e LETSENCRYPT_EMAIL="[email protected]" ...
Optional container environment variables

Optional nginx-proxy-letsencrypt container environment variables for custom configuration.

  • ACME_CA_URI - Directory URI for the CA ACME API endpoint (default: https://acme-v01.api.letsencrypt.org/directory)

For example

$ docker run -d -p 80:80 -p 443:443 \
    -e ACME_CA_URI="https://acme-staging.api.letsencrypt.org/directory" \
    -v /path/to/certs:/etc/nginx/certs \
    -v /var/run/docker.sock:/tmp/docker.sock:ro \
    dmp1ce/nginx-proxy-letsencrypt

Basic Authentication Support

In order to be able to secure your virtual host, you have to create a file named as its equivalent VIRTUAL_HOST variable on directory /etc/nginx/htpasswd/$VIRTUAL_HOST

$ docker run -d -p 80:80 -p 443:443 \
    -v /path/to/htpasswd:/etc/nginx/htpasswd \
    -v /path/to/certs:/etc/nginx/certs \
    -v /var/run/docker.sock:/tmp/docker.sock:ro \
    dmp1ce/nginx-proxy-letsencrypt

You'll need apache2-utils on the machine where you plan to create the htpasswd file. Follow these instructions

Custom Nginx Configuration

If you need to configure Nginx beyond what is possible using environment variables, you can provide custom configuration files on either a proxy-wide or per-VIRTUAL_HOST basis.

Replacing default proxy settings

If you want to replace the default proxy settings for the nginx container, add a configuration file at /etc/nginx/proxy.conf. A file with the default settings would look like this:

# HTTP 1.1 support
proxy_http_version 1.1;
proxy_buffering off;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $proxy_connection;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto;

NOTE: If you provide this file it will replace the defaults; you may want to check the .tmpl file to make sure you have all of the needed options.

Proxy-wide

To add settings on a proxy-wide basis, add your configuration file under /etc/nginx/conf.d using a name ending in .conf.

This can be done in a derived image by creating the file in a RUN command or by COPYing the file into conf.d:

FROM dmp1ce/nginx-proxy-letsencrypt
RUN { \
      echo 'server_tokens off;'; \
      echo 'client_max_body_size 100m;'; \
    } > /etc/nginx/conf.d/my_proxy.conf

Or it can be done by mounting in your custom configuration in your docker run command:

$ docker run -d -p 80:80 -p 443:443 -v /path/to/my_proxy.conf:/etc/nginx/conf.d/my_proxy.conf:ro -v /var/run/docker.sock:/tmp/docker.sock:ro dmp1ce/nginx-proxy-letsencrypt

Per-VIRTUAL_HOST

To add settings on a per-VIRTUAL_HOST basis, add your configuration file under /etc/nginx/vhost.d. Unlike in the proxy-wide case, which allows multiple config files with any name ending in .conf, the per-VIRTUAL_HOST file must be named exactly after the VIRTUAL_HOST.

In order to allow virtual hosts to be dynamically configured as backends are added and removed, it makes the most sense to mount an external directory as /etc/nginx/vhost.d as opposed to using derived images or mounting individual configuration files.

For example, if you have a virtual host named app.example.com, you could provide a custom configuration for that host as follows:

$ docker run -d -p 80:80 -p 443:443 -v /path/to/vhost.d:/etc/nginx/vhost.d:ro -v /var/run/docker.sock:/tmp/docker.sock:ro dmp1ce/nginx-proxy-letsencrypt
$ { echo 'server_tokens off;'; echo 'client_max_body_size 100m;'; } > /path/to/vhost.d/app.example.com

If you are using multiple hostnames for a single container (e.g. VIRTUAL_HOST=example.com,www.example.com), the virtual host configuration file must exist for each hostname. If you would like to use the same configuration for multiple virtual host names, you can use a symlink:

$ { echo 'server_tokens off;'; echo 'client_max_body_size 100m;'; } > /path/to/vhost.d/www.example.com
$ ln -s /path/to/vhost.d/www.example.com /path/to/vhost.d/example.com

Per-VIRTUAL_HOST default configuration

If you want most of your virtual hosts to use a default single configuration and then override on a few specific ones, add those settings to the /etc/nginx/vhost.d/default file. This file will be used on any virtual host which does not have a /etc/nginx/vhost.d/{VIRTUAL_HOST} file associated with it.

Per-VIRTUAL_HOST location configuration

To add settings to the "location" block on a per-VIRTUAL_HOST basis, add your configuration file under /etc/nginx/vhost.d just like the previous section except with the suffix _location.

For example, if you have a virtual host named app.example.com and you have configured a proxy_cache my-cache in another custom file, you could tell it to use a proxy cache as follows:

$ docker run -d -p 80:80 -p 443:443 -v /path/to/vhost.d:/etc/nginx/vhost.d:ro -v /var/run/docker.sock:/tmp/docker.sock:ro dmp1ce/nginx-proxy-letsencrypt
$ { echo 'proxy_cache my-cache;'; echo 'proxy_cache_valid  200 302  60m;'; echo 'proxy_cache_valid  404 1m;' } > /path/to/vhost.d/app.example.com_location

If you are using multiple hostnames for a single container (e.g. VIRTUAL_HOST=example.com,www.example.com), the virtual host configuration file must exist for each hostname. If you would like to use the same configuration for multiple virtual host names, you can use a symlink:

$ { echo 'proxy_cache my-cache;'; echo 'proxy_cache_valid  200 302  60m;'; echo 'proxy_cache_valid  404 1m;' } > /path/to/vhost.d/app.example.com_location
$ ln -s /path/to/vhost.d/www.example.com /path/to/vhost.d/example.com

Per-VIRTUAL_HOST location default configuration

If you want most of your virtual hosts to use a default single location block configuration and then override on a few specific ones, add those settings to the /etc/nginx/vhost.d/default_location file. This file will be used on any virtual host which does not have a /etc/nginx/vhost.d/{VIRTUAL_HOST} file associated with it.

Contributing

Before submitting pull requests or issues, please check github to make sure an existing issue or pull request is not already open.

Running Tests Locally

To run tests, you'll need to install bats 0.4.0.

make test

nginx-proxy-letsencrypt's People

Contributors

27bslash6 avatar bettse avatar bprodoehl avatar dadittoz avatar dariuszz123 avatar djdefi avatar dmp1ce avatar frank-dspeed avatar hadim avatar josephpage avatar jperville avatar jrcs avatar jwilder avatar kcyeu avatar mariusgundersen avatar maxcnunes avatar md5 avatar paimpozhil avatar pirelenito avatar rarous avatar richlewis007 avatar rnbwd avatar schmunk42 avatar sfc-gh-eraigosa avatar taxilian avatar thajeztah avatar thomasleveil avatar vegasbrianc avatar viranch avatar webner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nginx-proxy-letsencrypt's Issues

Unable to use LE cert

I switched from jwilder/nginx-proxy to use LetsEncrypt. It was working the other night as expected. Today, the domain using LE is referencing another proxied domain's non-LE cert in the browser (NET::ERR_CERT_COMMON_NAME_INVALID). To clarify, I'd like to use both LE and non-LE certs. Logs are as following:

letsencrypt.1 | Creating/renewal REMOVED.COM certificates... (REMOVED.COM)
letsencrypt.1 | 2015-12-16 07:03:17,428:ERROR:simp_le:197: Existing (REMOVED.COM, DOMAIN.REMOVED.COM) and requested (REMOVED.COM) SANs mismatch
letsencrypt.1 | Sleep for 3600s

...

letsencrypt.1 | Waiting 10s before updating certs...
letsencrypt.1 | Creating/renewal REMOVED.COM certificates... (REMOVED.COM DOMAIN.REMOVED.COM)
letsencrypt.1 | 2015-12-16 07:04:45,716:INFO:simp_le:1117: Certificates already exist and renewal is not necessary, exiting with status code 1.
letsencrypt.1 | Sleep for 3600s

Using docker-compose:

Proxied container docker-compose.yml:

...
environment:
    - VIRTUAL_HOST=REMOVED.COM,DOMAIN.REMOVED.COM
    - LETSENCRYPT_HOST=REMOVED.COM,DOMAIN.REMOVED.COM
    - [email protected]
...

Proxy container docker-compose.yml:

proxy:
  build: .
  restart: always
  volumes:
    - /path/to/certs:/etc/nginx/certs
    - /var/run/docker.sock:/tmp/docker.sock:ro
  ports:
    - 80:80
    - 443:443

Proxy container Dockerfile:

FROM dmp1ce/nginx-proxy-letsencrypt

RUN { \
      echo 'server_tokens off;'; \
      echo 'client_max_body_size 100m;'; \
    } > /etc/nginx/conf.d/my_proxy.conf

certificates renewal

What happen when a certificate expire ? Is there is a way to automatically renew it ?

HTTPS proxy-pass redirects to HTTP

I have an infinite loop in my configuration.

$ curl -i http://www.brownbag.tv
HTTP/1.1 301 Moved Permanently
Date: Sun, 27 Dec 2015 13:29:15 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
Location: https://www.brownbag.tv/
Server: cloudflare-nginx
CF-RAY: 25b55f9271c43560-LHR

<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/1.9.6</center>
</body>
</html>

$ curl -i https://www.brownbag.tv
HTTP/1.1 301 Moved Permanently
Server: cloudflare-nginx
Date: Sun, 27 Dec 2015 13:29:21 GMT
Transfer-Encoding: chunked
Connection: keep-alive
Location: http://www.brownbag.tv/
CF-RAY: 25b55fb5415a3488-LHR

This is my docker-compose.yml file

nginx:
  image: dmp1ce/nginx-proxy-letsencrypt:latest
  volumes:
    - /var/run/docker.sock:/tmp/docker.sock
  ports:
    - 80:80
    - 443:443
  restart: always
web:
  build: .
  environment:
    VIRTUAL_HOST: 'www.brownbag.tv'
    LETSENCRYPT_HOST: 'www.brownbag.tv'
    LETSENCRYPT_EMAIL: '<>'
    NODE_ENV: 'production'
  restart: always

Here is the generated nginx.conf - https://gist.github.com/BenHall/b0922114dd9903b81515

The proxy-pass is "proxy_pass http://www.brownbag.tv" but this just redirects to HTTPS.

nginx config not updated to use SSL when certificates is created/downloaded

Having a pretty standard configuration and nginx-proxy-letsencrypt usage, certificates are correctly downloaded and saved into /etc/nginx/certs/ but the nginx config is not updated.

It works when I manually enter in the container and execute the following command /usr/local/bin/docker-gen -watch -only-exposed -notify "/app/update_nginx" /app/nginx.tmpl /etc/nginx/conf.d/default.conf.

Any idea ?

Redirect loop with https

Hello dmp1ce,

Thank you for a wonderful project. It's really quite unbelievable how easy it is to connect the pieces now, to get a fully SSL-enabled application out there. That said, I have a small wrinkle that I'm not sure what to do with. Basically, when accessing my rails application, I end up with a weird redirect loop on every second request:

curl -I -X GET https://potatr.duckdns.org/users/sign_in

HTTP/1.1 301 Moved Permanently
Server: nginx/1.9.6
Date: Wed, 23 Dec 2015 03:51:20 GMT
Content-Type: text/html
Content-Length: 184
Connection: keep-alive
Location: https://potatr.duckdns.org/users/sign_in
Strict-Transport-Security: max-age=31536000

and in the nginx-proxy-letsencrypt container:

nginx.1      | potatr.duckdns.org 192.235.240.9 - - [23/Dec/2015:03:51:20 +0000] "GET /users/sign_in HTTP/1.1" 301 184 "-" "curl/7.37.1"
nginx.1      | potatr.duckdns.org 172.17.0.4 - - [23/Dec/2015:03:51:20 +0000] "GET /users/sign_in HTTP/1.1" 301 184 "-" "curl/7.37.1"

where 192.* is my request, and 172.* is the container running my app.

Here's the second request:

curl -I -X GET https://potatr.duckdns.org/users/sign_in

HTTP/1.1 200 OK
Server: nginx/1.9.6
Date: Wed, 23 Dec 2015 03:56:40 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Status: 200 OK
Cache-Control: max-age=0, private, must-revalidate
Vary: Origin
ETag: W/"9585f8f7ff8d9d2a99003128be83023a"
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Runtime: 0.024472
X-Request-Id: 15dfe9a5-dd39-49d9-ba1c-ee0c86b38ce3
Set-Cookie: _potatr_session=TWRlTDloUUIvYmNoUU5MK00yU0ZHWWxrZXJEWHhnc3kranNrZmcySVAray9sak03WS8xVVpXWlowdnp3TEhONjdRSFU3OFZnODRROEtza0lMV2diNlBuaXU3TFRlTmF4NWRvWWk5Y3ZGRE9LWWNlWWtDM2NidGNvdEpGalRJMENEVDhieGRZbUJBWHZwci9VSElSMTlnPT0tLWlhRDlzVk5xZkRqY2tnNFg1U2xGakE9PQ%3D%3D--4d8cf4c536109a2cfe6dcfd3861dfc1f3801e0d9; path=/; HttpOnly
X-Powered-By: Phusion Passenger 5.0.15
Strict-Transport-Security: max-age=31536000

and in the proxy container:

nginx.1      | potatr.duckdns.org 192.235.240.9 - - [23/Dec/2015:03:56:40 +0000] "GET /users/sign_in HTTP/1.1" 200 4757 "-" "curl/7.37.1"

Any idea what's going on here? It almost looks like the app inside the container redirecting back to itself. Can you spot anything obviously wrong?

Thanks again.

Possibility to proxy non containers

Hi There, thank you for your great bundle! I'm looking for a way to proxy & create Let's Encrypt Certificates for vhosts that don't have a container. For instance some remote control interface that is running on a raspberry pi. Right now I'm using a second (regular) nginx container to achieve this:

client --(https)--> nginx-proxy ---(http)---> nginx --(http)---> raspberrypi

It works but it's a bit inefficient to have 2 proxies :). Is there already a way to tell nginx-proxy about a vhost that isn't a container but still receive an SSL certificate from letsencrypt or would that be a new feature?

Best regards.

Pascal Helfenstein

CircleCI build failing due to btrfs errors

I'm not sure how to test changes to the CircleCI build without comitting so I'm posting this bug in hopes that someone can help.

Right now it looks like the CircleCI build is failing due to multiple "Error deleting container: Error response from daemon: Driver btrfs failed to remove root " errors.

The tests all pass on my computer running Arch Linux, Docker 1.9.1 and using devicemapper for the storage backend.

Update README

Update README to replace jwilder/nginx-proxy by dmp1ce/nginx-proxy-letsencrypt

Unable to create a new LE cert

After updating to the latest version there seems to be a problem with getting LE certs

dockergen.1  | 2015/12/10 16:48:21 Received event start for container d129a08577a5
dockergen.1  | 2015/12/10 16:48:21 Generated '/etc/nginx/conf.d/default.conf' from 2 containers
letsencrypt.1 | Waiting 10s before updating certs...
letsencrypt.1 | Creating/renewal DOMAIN.REMOVED.COM certificates... (DOMAIN.REMOVED.COM)
letsencrypt.1 | 2015-12-10 16:48:31,936:INFO:simp_le:950: Generating new account key
letsencrypt.1 | 2015-12-10 16:48:34,713:INFO:urllib3.connectionpool:697: Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
letsencrypt.1 | 2015-12-10 16:48:35,026:INFO:urllib3.connectionpool:697: Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
letsencrypt.1 | 2015-12-10 16:48:35,331:INFO:urllib3.connectionpool:697: Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
letsencrypt.1 | 2015-12-10 16:48:36,060:INFO:urllib3.connectionpool:697: Starting new HTTPS connection (1): letsencrypt.org
letsencrypt.1 | 2015-12-10 16:48:36,586:INFO:urllib3.connectionpool:697: Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
letsencrypt.1 | 2015-12-10 16:48:36,928:INFO:urllib3.connectionpool:697: Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
letsencrypt.1 | 2015-12-10 16:48:38,896:INFO:urllib3.connectionpool:188: Starting new HTTP connection (1): DOMAIN.REMOVED.COM
nginx.1      | DOMAIN.REMOVED.COM 192.168.1.1 - - [10/Dec/2015:16:48:39 +0000] "GET /.well-known/acme-challenge/WVE_LDs_V2jStfteYzCF-Ym0jvfWXp80BKAnkwH3JhA HTTP/1.1" 503 212 "-" "python-requests/2.4.3 CPython/2.7.9 Linux/3.13.0-30-generic"
letsencrypt.1 | 2015-12-10 16:48:39,040:WARNING:simp_le:1050: DOMAIN.REMOVED.COM was not successfully self-verified. CA is likely to fail as well!
letsencrypt.1 | 2015-12-10 16:48:39,068:INFO:urllib3.connectionpool:697: Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
letsencrypt.1 | 2015-12-10 16:48:39,396:INFO:simp_le:1060: Generating new certificate private key
letsencrypt.1 | 2015-12-10 16:48:40,392:INFO:urllib3.connectionpool:697: Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
letsencrypt.1 | 2015-12-10 16:48:40,679:ERROR:simp_le:1018: CA marked some of the authorizations as invalid, which likely means it could not access http://example.com/.well-known/acme-challenge/X. Did you set correct path in -d example.com:path or --default_root? Is there a warning log entry about unsuccessful self-verification? Are all your domains accessible from the internet? Failing authorizations: https://acme-v01.api.letsencrypt.org/acme/authz/MDmfx8dik-spcEH_H7YBu8XgSCWBe-syT4vgUMTfpr0
letsencrypt.1 | Challenge validation has failed, see error log.
letsencrypt.1 | Sleep for 3600s
nginx.1      | DOMAIN.REMOVED.COM 66.133.109.36 - - [10/Dec/2015:16:48:44 +0000] "GET /.well-known/acme-challenge/WVE_LDs_V2jStfteYzCF-Ym0jvfWXp80BKAnkwH3JhA HTTP/1.1" 503 212 "-" "Mozilla/5.0 (compatible; Let's Encrypt validation server; +https://www.letsencrypt.org)"

As you can see from the log above (with domain removed) it appears to fail before the lets encrypt service does the verification. Could this be some sort of timeout that needs increasing?

Best certificate match doesn't work well for letsencrypt certificates

Current letsencrypt certificates must exactly match hostname. So substituting domain.com.crt for www.domain.com.crt renders an SSL error.

This line of code in nginx.tmpl is responsible for generating such substitution

{{/* Get the best matching cert  by name for the vhost. */}}
{{ $vhostCert := (closest (dir "/etc/nginx/certs") (printf "%s.crt" $host))}}

Errors when updating certs.

This docker fails to update certs since a couple of days. Might be because some changes done to nginx-proxy?

Might be worth mentioning on the page if you do not intend to continue developing this image.

All the best!

letsencrypt.1 | Traceback (most recent call last):
letsencrypt.1 |     working_set = WorkingSet._build_master()
letsencrypt.1 |     ws.require(__requires__)
letsencrypt.1 |     needed = self.resolve(parse_requirements(requirements))
letsencrypt.1 |     requirements.extend(dist.requires(req.extras)[::-1])
letsencrypt.1 |     dm = self._dep_map
letsencrypt.1 |   File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2597, in _dep_map
letsencrypt.1 |     self.__dep_map = self._compute_dependencies()
letsencrypt.1 |   File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2614, in _compute_dependencies
letsencrypt.1 |     from _markerlib import compile as compile_marker
letsencrypt.1 | ImportError: No module named _markerlib

Unable to create a LE cert with two domains in LETSENCRYPT_HOST

Hi,

good work! Thank you.

But if I enter two domains in the LETSENCRYPT_HOST variable, for example

docker run -e LETSENCRYPT_HOST="foo.bar.com,bar.com"

then I get the error:

ERROR:simp_le:1018: CA marked some of the authorizations as invalid, which likely means it could not access http://example.com/.well-known/acme-challenge/X. Did you set correct path in -d example.com:path or --default_root? Is there a warning log entry about unsuccessful self-verification? Are all your domains accessible from the internet? Failing authorizations: https://acme-v01.api.letsencrypt.org/acme/authz/

But with only one domain it works fine.

Can you add the HPKP? see https://en.wikipedia.org/wiki/HTTP_Public_Key_Pinning

Regards Jake

Redirect to https happens after the authentication

For the hosts where I have the authentication in the nginx proxy I would like to login over HTTPS. I don't get automatically redirected the first time and when I specify the url and have https in the beginning I will get redirected to the next webpage in my list, like the webpage doesn't even exist. After I have logged in over http I have no further issues with access the same site over https.

Thanks

Cicle CI build is broken

I'm not sure how to setup a Circle CI build. I'm thinking this project should use the build status from nginx-proxy.

All vhosts redirect to https

I switched from jwilder/nginx-proxy to dmp1ce/nginx-proxy-letsencrypt and it works really great. Thanks!

But I've noticed that all requests are now redirected to https regardless of whether the LETSENCRYPT_HOST variable is set on the backend container. This makes impossible to have non-https sites.

Is this behavior intentional? jwilder/nginx-proxy only redirects to https if there is a key and a certificate available. I think it would be nice to keep this functionality and only enable the https redirect if there key and certificate are present.

My suggestion is:

  • By default serve over http without redirect
  • If the .key and .crt files are present, enable the https redirect
  • If LETSENCRYPT_HOST and LETSENCRYPT_EMAIL are present, automatically obtain a certificate and enable the https redirect.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.