L
L
lovesuper2014-08-14 21:05:03
Nginx
lovesuper, 2014-08-14 21:05:03

How to make 2 https hosts (domain and subdomain) with different ssl certificates in nginx on one IP?

Good afternoon. The problem is this. I have two applications on the same IP on different internal EU ports. I need to make two hosts https://a.test.org and https://test.org . Each has its own certificate. I tried to do it in the usual way - receiving on 443 and forwarding to the internal socket of the application (each to its own), but it turned out strange - the same application answers both domains! Friends, how to overcome the problem?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
Nazar Mokrinsky, 2014-08-14
@nazarpc

Two separate virtual hosts, both listening on 443, but one server_name is a.test.org and the other is test.org.

N
neol, 2014-08-14
@neol

Two different emnip certificates only via SNI:
nginx.org/ru/docs/http/configuring_https_servers.h...
en.wikipedia.org/wiki/Server_Name_Indication

S
s1dney, 2014-08-14
@s1dney

Here is a snippet that has been working for me on a huge number of hosts with SSL for many years:

listen 1.2.3.4:443;
        server_name secure.domain.com;

        ssl on; #опция по-моему уже deprecated
        ssl_certificate     /etc/nginx/ssl/secure.domain.com.pem;
        ssl_certificate_key /etc/nginx/ssl/secure.comain.com.key;
        ssl_ciphers RC4:HIGH:!aNULL:!MD5:!kEDH;
        ssl_prefer_server_ciphers on;
        ssl_session_cache shared:SSL:10m;

        root /var/www/domain;
        index index.html index.htm index.php;

If this doesn't work, how do you check?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question