[edit] Using Wildcard certificates with multiple servers

In some instances you may wish to provide a number of secure subdomains amongst unsecured ones, and possibly share resources across both HTTP and HTTPS subdomains. To do this one would require a wildcard subdomain, for example *.nginx.org. An example configuration follows which shows how to configure a standard www subdomain, a secured subdomain, and share images across both subdomains using a third.

When using a configuration like this it's more efficient memory wise to place the certificate file containing the certificate(s) for all domain names and the corresponding private key file directives in a http context, such that it's inherited by all active servers/virtual hosts:

ssl_certificate      common.crt;
ssl_certificate_key  common.key;
 
server {
  listen           80;
  server_name      www.nginx.org;
  ...
}
 
server {
  listen           443 default_server ssl;
  server_name      secure.nginx.org;
  ...
}
 
server {
  listen           80;
  listen           443;
  server_name      images.nginx.org;
  ...
}

[edit] Directives


Module: HttpSslModule