0

I have a domain, let's say example.com

I know that it is possible to use example.com as a "extension". I know I am using the wrong term, but I don't know the technical term.

What I means is, having something like site.example.com and another.example.com

I have a Ubuntu 16 machine running nginx, serving content at example.com.

How can I make this machine serve one content at site.example.com and another at another.example.com?

Thank you!

mayk93
  • 115
  • 2
  • 5

2 Answers2

0

Yes, you are basically wanting other hostnames to be valid in your DNS zone (domain) and then once you have DNS working for the other names you'll want to set up a new name based host (Apache term) or a new server definition (nginx)

ivanivan
  • 1,488
  • 7
  • 6
0

So let's say you have a domain, example.com

You presumably have paid to control the domain (register it) and to associate the domain name with an IP address (DNS service). Quite likely you are using the same company for both.

The company that you pay for DNS service, also most likely will provide DNS service for at least other hosts within your domain (site.example.com, another.example.com) and probably sub-domains (another topic). You can review their site for help setting up your DNS "zone" or "records".

If you are using one server to host different content for multiple host names, the first step is to configure the additional hosts to associate the other host names (e.g. site.example.com) with the same IP address associated with example.com.

The second step is to configure your web server. This article addresses that challenge in some detail: https://superuser.com/questions/841910/host-multiple-website-using-nginx-on-the-same-ip#841920

Slartibartfast
  • 3,295
  • 18
  • 16