4
4
4upik2020-02-29 14:06:36
Nginx
4upik, 2020-02-29 14:06:36

How to register 2 ssl paths for two domains in the 1st nginx config?

Is it possible to prescribe different paths in one configuration file, for the main domain one path for another subdomain another path? Both domains work in conjunction and give out different content at the php level, so they are configured in one file.
Now the config is

server {
     listen      ip:443;
   server_name site.ru www.site.ru sub.site.ru;
    root        /home/maxmarket/web/site.ru/public_html;
    index       index.php index.html index.htm;
    access_log  /var/log/nginx/domains/site.ru.log combined;
    access_log  /var/log/nginx/domains/site.ru.bytes bytes;
    error_log   /var/log/nginx/domains/site.ru.error.log error;

    ssl         on;
    ssl_certificate      /home/maxmarket/conf/web/ssl.site.ru.pem;
    ssl_certificate_key  /home/maxmarket/conf/web/ssl.site.ru.key;


How to prescribe a different ssl certificate path for sub.site.ru?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
ky0, 2020-02-29
@ky0

server_nameoperates within the block server. Accordingly, even if the certificate is issued for both the main domain and the subdomain (which is generally wrong), the processing rules must be in different blocks (unless, of course, they are similar - then you can simply server_namespecify both names).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question