Score:0

How to configure domain for a exists domain

in flag

to begin with, I have a very little knowledge about the configuration, but I have a question to ask.

I have two website with the domain

  1. website1.domain.com
  2. websites.domain.com

At each domain, I buy another domain for them.

  1. website1.com
  2. website2.com

I would like to ask, how can I configure the website1.com and website2.com to forward into website1.domain.com and website2.domain.com?

When a user goes to website1.com, it will NOT REDIRECT to website1.domain.com, but still be the same URL (website1.com)? And how can I use Let's Encrypt to config the SSL for each website?

Note:

  1. I am using Nginx to configure the domain for website1.domain.com and website2.domain.com

It's the same how WordPress let their user to configure their own domain on their personal WordPress site. I am not an expert in DevOps, so can you guys please give me a solution, or some keyword to research?

Score:1
us flag
Rob

Configure the correct DNS records

Point the DNS host/domain names for which you want show websites to the IP-address of your webserver.

Configure the web server

Like all modern web servers nginx allows you to assign multiple DNS host/domain names to a single virtual server with the server_name directive.

server {
    server_name website1.example.com website1.com;
    
    location / {
      root    /var/www/virtual/website1.example.com/htdocs;
    }
}
server {
    server_name website2.example.com website2.com;

    location / {
      root    /var/www/virtual/website2.example.com/htdocs;
    }
}

Let's Ecrypt

It really depends on how you configured Let's Encrypt before but you can add additional domain/host-names to an existing Let's Encrypt certificate configuration.

To add website1.com to an existing certificate use for example:

certbot --cert-name website1.example.com -d website1.example.com -d website1.com
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.