multiple ssl certificates within single server {} block

Richard Kearsley richard at kearsley.me
Tue Nov 5 16:51:12 UTC 2013


On 05/11/13 16:27, Tim Düsterhus wrote:
> This sounds like you want to use `include`, i use it myself for general
> settings, valid for any domain:

fair point

would it work like this (an include in an include?)

http
{
     include www.example.com.conf;
     include www.test.com.conf;
     include www.something.com.conf;
}

www.example.com.conf:

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

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

         include locations.conf;
     }

www.test.com.conf:

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

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

         include locations.conf;
     }

www.something.com.conf:


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

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

         include locations.conf;
     }

locations.conf:

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

         # and about 10 other locations!




More information about the nginx mailing list