Configure subdomain of different host on nginx server which is configured on some other host.

Posted December 5, 2020 626 views

I am trying to configure host name like on my already setup of nginx server with server_name like Both and have different ssl certificates.

I have configured server for like below

server {

    listen 443 ssl;

    ssl_certificate /usr/local/etc/nginx/ssl/self1.crt;
    ssl_certificate_key /usr/local/etc/nginx/ssl/self1.key; 

    location /temp {

I am curious whether this is the proper way to achieve this or there is any better way. Thanks.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hi there @akshaybande81,

If you want to show the same content on as you do on, what you could do is to copy the existing Server Block that you have for and just change the server_name.

That way the two sites will have separate Nginx server blocks and separate SSL certificates, but they will be showing the same content.