Add (nonexistent) document root so we don't use the default value (#5437)

This commit is contained in:
ohemorange 2018-01-17 08:02:10 -08:00 committed by Brad Warren
parent 2c379cd363
commit e9b57e1783

View file

@ -155,10 +155,15 @@ class NginxHttp01(common.ChallengePerformer):
addrs = self._default_listen_addresses()
block = [['listen', ' ', addr.to_string(include_default=False)] for addr in addrs]
# Ensure we 404 on any other request by setting a root
document_root = os.path.join(
self.configurator.config.work_dir, "http_01_nonexistent")
validation = achall.validation(achall.account_key)
validation_path = self._get_validation_path(achall)
block.extend([['server_name', ' ', achall.domain],
['root', ' ', document_root],
[['location', ' ', '=', ' ', validation_path],
[['default_type', ' ', 'text/plain'],
['return', ' ', '200', ' ', validation]]]])