Skip to content

how to add a subdomain to a LIghtsail instance

0

How do I set a directory within a Lightsail instance as a subdomain?

asked 2 years ago939 views

1 Answer
0
Accepted Answer

To add a subdomain to a Lightsail instance, you'll need to follow a two-step process: creating a DNS record for the subdomain and configuring your web server to handle the subdomain.

First, let's create the DNS record:

  1. Sign in to the Lightsail console.
  2. Go to the "Domains & DNS" tab.
  3. Select the DNS zone for your domain.
  4. Choose "Add record" in the DNS records section.
  5. For the record type, select "A record".
  6. In the "Subdomain" field, enter your desired subdomain (e.g., "blog" for blog.example.com).
  7. In the "Resolves to" field, enter the static IP address of your Lightsail instance.
  8. Save the record.

After creating the DNS record, you'll need to configure your web server to handle the subdomain. This process varies depending on your web server software (e.g., Apache, Nginx), but generally involves:

  1. Creating a new directory for your subdomain content within your Lightsail instance.
  2. Configuring a virtual host or server block for the subdomain, pointing to the new directory.
  3. Restarting your web server to apply the changes.

It's important to note that simply creating a directory within your Lightsail instance does not automatically make it accessible as a subdomain. You must configure your web server to recognize and serve content from that directory for the specific subdomain.

Remember to allow time for DNS changes to propagate, which can take up to 48 hours in some cases. After everything is set up correctly, your subdomain should be accessible and serving content from the specified directory within your Lightsail instance.
Sources
Point your domain to a Lightsail load balancer - Amazon Lightsail
Point a domain to your Lightsail instance using Amazon Route 53 - Amazon Lightsail
Route domain traffic to a Lightsail instance - Amazon Lightsail

answered 2 years ago

EXPERT

reviewed 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.