Skip to content

Instantly share code, notes, and snippets.

@jahands
Last active March 8, 2016 18:41
Show Gist options
  • Save jahands/85054f2ef2eb0df217c1 to your computer and use it in GitHub Desktop.
Save jahands/85054f2ef2eb0df217c1 to your computer and use it in GitHub Desktop.

EXAMPLE 1 (shared blocks)

site1.com, site2.com {
  tls me@example.com
}
site3.com, site4.com {
  tls me@foo.com
}

site1.com, site2.com, site3.com, site4.com {
  # ERROR, each directive can only be in one shared block!
}

site1.com {
    root /some/path
}
site2.com {
    root /some/path2
}
site3.com {
    root /some/path3
}
site4.com {
    root /some/path4
}

TRANSLATES INTO

site1.com {
    root /some/path
    tls me@example.com
}
site2.com {
    root /some/path2
    tls me@example.com
}
site3.com {
    root /some/path3
    tls me@foo.com
}
site4.com {
    root /some/path4
    tls me@foo.com
}

EXAMPLE 2 (path matching)

example.com {
    root /path
}
example.com/static {
    root /pathtostatic
}

EXAMPLE 3 (wildcards)

example.com {
    
}

*.example.com {
   # applies to eg. foo.example.com, but not bar.foo.example.com. Wildcards only apply to 1 label level.
}
static.example.com {
    root /pathtostatic
    # is not effected by the block above because this is more specific and is used instead without inheritance of the above block.
}
*.foo.example.com, *.bar.example.com {
    # shared
}
*.foo.example.com {
    # stuff that only applies to *.foo.example.com
}
*.bar.example.com {
    # stuff that only applies to *.bar.example.com
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment