mirror of
https://github.com/certbot/certbot.git
synced 2026-08-01 19:02:52 +02:00
Merge pull request #7738 from osirisinferi/nginx-hostname
[nginx] Parse $hostname in `server_name`
This commit is contained in:
@@ -313,9 +313,6 @@ class NginxConfigurator(common.Installer):
|
||||
.. todo:: This should maybe return list if no obvious answer
|
||||
is presented.
|
||||
|
||||
.. todo:: The special name "$hostname" corresponds to the machine's
|
||||
hostname. Currently we just ignore this.
|
||||
|
||||
:param str target_name: domain name
|
||||
:param bool create_if_no_match: If we should create a new vhost from default
|
||||
when there is no match found. If we can't choose a default, raise a
|
||||
@@ -598,6 +595,12 @@ class NginxConfigurator(common.Installer):
|
||||
all_names = set() # type: Set[str]
|
||||
|
||||
for vhost in self.parser.get_vhosts():
|
||||
try:
|
||||
vhost.names.remove("$hostname")
|
||||
vhost.names.add(socket.gethostname())
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
all_names.update(vhost.names)
|
||||
|
||||
for addr in vhost.addrs:
|
||||
|
||||
Reference in New Issue
Block a user