Question

DNS records and wildcards

My DNS records direct to several droplets as specified below:

hostname Value
*.django IP#1
*.pipit IP#2
* IP#3

Navigating to the IP address, each IP displays a different content, as expected.

However, switching the subdomain/Hostname with the IP, all hostnames point to the domaine name. In that case, leacards.site.

How should I then point correctly the subdomain to the specific IP rather than the domain-name?

Thanks for your considertion.


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

alexdo
Site Moderator
Site Moderator badge
May 5, 2023

Hello @leacards

To properly handle the subdomains, you need to set up virtual hosts (for Apache) or server blocks (for Nginx) on your droplets to direct the traffic to the correct document root based on the requested domain.

For Apache, you can follow this tutorial to set up virtual hosts: How to Set Up Apache Virtual Hosts on Ubuntu 18.04.

For Nginx, you can follow this tutorial to set up server blocks: How to Set Up Nginx Server Blocks (Virtual Hosts) on Ubuntu 16.04.

Make sure to replace the example domain names with your own subdomains and IP addresses. If you still experience issues, please provide more information about your web server and configuration so we can check this with you.

Hope that this helps!

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

card icon
Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Sign up
card icon
Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We’d like to help.

Learn more
card icon
Become a contributor

You get paid; we donate to tech nonprofits.

Learn more
Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow – whether you’re running one virtual machine or ten thousand.

Learn more ->
DigitalOcean Cloud Control Panel