From 97acf341989bc777632ecb7703701dbf9d3f7fbe Mon Sep 17 00:00:00 2001 From: Erica Portnoy Date: Thu, 11 Jan 2018 17:28:31 -0800 Subject: [PATCH] import --- certbot-nginx/certbot_nginx/http_01.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/certbot-nginx/certbot_nginx/http_01.py b/certbot-nginx/certbot_nginx/http_01.py index 1f1e37891..2bfb02522 100644 --- a/certbot-nginx/certbot_nginx/http_01.py +++ b/certbot-nginx/certbot_nginx/http_01.py @@ -5,6 +5,7 @@ import os from acme import challenges +from certbot import errors from certbot.plugins import common @@ -93,8 +94,13 @@ class NginxHttp01(common.ChallengePerformer): :class:`certbot.achallenges.KeyAuthorizationAnnotatedChallenge` """ - vhost = self.configurator.choose_redirect_vhost(achall.domain, - '%i' % self.configurator.config.http01_port, create_if_no_match=True) + try: + vhost = self.configurator.choose_redirect_vhost(achall.domain, + '%i' % self.configurator.config.http01_port, create_if_no_match=True) + except errors.MisconfigurationError: + # Couldn't find either a matching name+port server block + # or a port+default_server block, so create a dummy block + validation = achall.validation(achall.account_key) validation_path = self._get_validation_path(achall)