setup multiple SSL servers in one config

Jonathan Garvin jgarvin at wwidea.org
Tue May 12 03:57:10 MSD 2009


I'm in the process of trying to convert a Pound config file that manages
multiple SSL sites over to Nginx.  If I just have one site setup in the
nginx.conf file then everything, including the SSL, works fine. But if I
add a second server block for a different domain, then the second tries
to use the SSL certificate for the first, resulting in the browser
raising security warnings.  My conf file is below.  Any hints at what I
am doing wrong would be greatly appreciated.

-----------------------------------

user  wwidea;
worker_processes  1;

events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;
    passenger_root /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.2;
    passenger_ruby /usr/local/bin/ruby;
    passenger_max_pool_size 20;
    passenger_pool_idle_time 3600;

    sendfile        on;
    gzip               on;
    keepalive_timeout  65;

    server {
        listen       443;
        server_name  www.domain1.com;
        root /var/rails/domain1/current/public;
       
        ssl    on;
        proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect false;
        proxy_max_temp_file_size 0;
        ssl_certificate    /var/ssl-certs/domain1.cert;
        ssl_certificate_key    /var/ssl-certs/domain1.key;
        index  index.html index.htm;
        passenger_enabled on;
    }
   
    server {
        listen       443;
        server_name  www.domain2.com;
        root /var/rails/domain2/current/public;
       
        ssl    on;
        proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect false;
        proxy_max_temp_file_size 0;
        ssl_certificate    /var/ssl-certs/domain2.cert;
        ssl_certificate_key    /var/ssl-certs/domain2.key;
        index  index.html index.htm;
        passenger_enabled on;
    }
}






More information about the nginx mailing list