Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9158855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:21:00+00:00 2026-06-17T13:21:00+00:00

I’d love to use nginx to serve a website with multiple domain names and

  • 0

I’d love to use nginx to serve a website with multiple domain names and SSL:

  • webmail.example.com
  • webmail.beispiel.de

Both use the same vhost so I only set the server_name twice.
Problem is, that I need nginx to serve the correct ssl certificate for each domain name.

Is this possible with one vhost or do I need to set up two vhosts?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T13:21:01+00:00Added an answer on June 17, 2026 at 1:21 pm

    Edit November 2014: the initial answer is not correct and is incomplete ; it needed a refresh! here it is.

    Basically, there are two cases

    • You own a wildcard certificate (or multi-domains certificate)

    In this case, you may use several vhosts listening to the same IP address/https port, and both vhosts use the same certificate (listening on all interfaces), e.g.

        server {
          listen 443;
          server_name webmail.example.com;
          root /var/www/html/docs/sslexampledata;
        
          ssl on;
          ssl_certificate /var/www/ssl/samecertif.crt;
          ssl_certificate_key /var/www/ssl/samecertif.key;
          ...
        }
        
        
        server {
          listen 443;
          server_name webmail.beispiel.de;
          root /var/www/html/docs/sslbeispieldata;
        
          ssl on;
          ssl_certificate /var/www/ssl/samecertif.crt;
          ssl_certificate_key /var/www/ssl/samecertif.key;
          ...
        }
    

    or in you specific case, having both domains served by the same data

        server {
          listen 443;
          server_name webmail.example.com webmail.beispiel.de; # <== 2 domains
          root /var/www/html/docs/sslbeispieldata;
        
          ssl on;
          ssl_certificate /var/www/ssl/samecertif.crt;
          ssl_certificate_key /var/www/ssl/samecertif.key;
          ...
        }
    

    • You have two(+) different certificates

    The case above (one IP for all certificates) will still work with modern browsers via Server Name Indication. SNI has the client (browser) send the host it wants to reach in the request header, allowing the server (nginx) to deal with vhosts before having to deal with the certificate. The configuration is the same as above, except that each vhost has a specific certificate, crt and key.

    (nginx support SNI from 0.9.8f, check your nginx server is SNI compliant)
    (also, SF talks about SNI and browser support)

    Otherwise, if you want to reach older browsers as well, you need several vhosts listening each to a different IP addresses/https ports, e.g.

        server {
          listen 1.2.3.4:443; # <== IP 1.2.3.4
          server_name webmail.example.com;
          root /var/www/html/docs/sslexampledata;
        
          ssl on;
          ssl_certificate /var/www/ssl/certifIP1example.crt;
          ssl_certificate_key /var/www/ssl/certifIP1example.key;
          ...
        }
        
        
        server {
          listen 101.102.103:443; <== different IP
          server_name webmail.beispiel.de;
          root /var/www/html/docs/sslbeispieldata;
        
          ssl on;
          ssl_certificate /var/www/ssl/certifIP2beispiel.crt;
          ssl_certificate_key /var/www/ssl/certifIP2beispiel.key;
          ...
        }
    

    The reason is well explained here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I am confused How to use looping for Json response Array in another Array.
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
i got an object with contents of html markup in it, for example: string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.