multiple ssl certificates within single server {} block

Richard Kearsley richard at kearsley.me
Tue Nov 5 13:57:21 UTC 2013


On 05/11/13 13:50, Jonathan Matthews wrote:
> Please show a duplicated (i.e. operationally inefficient) config that 
> you wish to aggregate, as I don't understand the result you're aiming 
> for. J

something like this is the only way I see to do it currently:

http
{
     server
     {
         listen 80;
         listen 443 ssl;
         server_name www.example.com

         ssl_certificate www.example.com.cer;
         ssl_certificate_key www.example.com.key;

         location /
         {
             # lots of config here
             # which I really don't want to duplicate
         }

         # and about 10 other locations!
     }

     server
     {
         listen 80;
         listen 443 ssl;
         server_name www.test.com

         ssl_certificate www.test.com.cer;
         ssl_certificate_key www.test.com.key;

         location /
         {
             # lots of config here
             # which I really don't want to duplicate
         }

         # and about 10 other locations!
     }

     server
     {
         listen 80;
         listen 443 ssl;
         server_name www.something.com

         ssl_certificate www.something.com.cer;
         ssl_certificate_key www.something.com.key;

         location /
         {
             # lots of config here
             # which I really don't want to duplicate
         }

         # and about 10 other locations!
     }
}

this could go on for 100's of domains...

Cheers
--
Richard







More information about the nginx mailing list