# `certbot_nginx.obj`

Module contains classes used by the Nginx Configurator.

class `certbot_nginx.obj.``Addr`(host, port, ssl, default, ipv6, ipv6only)

  Bases: `certbot.plugins.common.Addr`

  Represents an Nginx address, i.e. what comes after the ‘listen’ directive.

  According to the documentation, this may be address[:port], port, or unix:path. The latter is ignored here.

  The default value if no directive is specified is *:80 (superuser) or *:8000 (otherwise). If no port is specified, the default is 80. If no address is specified, listen on all addresses.

  Todo

  Old-style nginx configs define SSL vhosts in a separate block instead of using ‘ssl’ in the listen directive.

  Parameters:

  - addr (str) – addr part of vhost address, may be hostname, IPv4, IPv6, “”, or “*”
  - port (str) – port number or “*” or “”
  - ssl (bool) – Whether the directive includes ‘ssl’
  - default (bool) – Whether the directive includes ‘default_server’
  - default – Whether this is an IPv6 address
  - ipv6only (bool) – Whether the directive includes ‘ipv6only=on’

  classmethod `fromstring`(str_addr)

    Initialize Addr from string.

  `to_string`(include_default=True)

    Return string representation of Addr

  `super_eq`(other)

    Check ip/port equality, with IPv6 support.

class `certbot_nginx.obj.``VirtualHost`(filep, addrs, ssl, enabled, names, raw, path)

  Bases: `object`

  Represents an Nginx Virtualhost.

  Variables:

  - filep (str) – file path of VH
  - addrs (set) – Virtual Host addresses (`set` of `Addr`)
  - names (set) – Server names/aliases of vhost (`list` of `str`)
  - raw (list) – The raw form of the parsed server block
  - ssl (bool) – SSLEngine on in vhost
  - enabled (bool) – Virtual host is enabled
  - path (list) – The indices into the parsed file used to access the server block defining the vhost

  `has_header`(header_name)

    Determine if this server block has a particular header set. :param str header_name: The name of the header to check for, e.g.

    > ‘Strict-Transport-Security’

  `contains_list`(test)

    Determine if raw server block contains test list at top level

  `ipv6_enabled`()

    Return true if one or more of the listen directives in vhost supports IPv6

  `ipv4_enabled`()

    Return true if one or more of the listen directives in vhost are IPv4 only

  `display_repr`()

    Return a representation of VHost to be used in dialog

`certbot_nginx.obj.``_find_directive`(directives, directive_name, match_content=None)

  Find a directive of type directive_name in directives. If match_content is given, Searches for `match_content` in the directive arguments.