Hello,
I have one droplet with 2 distinct DNS entries pointing to it.
domain1.ca. 1800 IN A [ip] domain1.ca. 1800 IN NS ns1.digitalocean.com. domain1.ca. 1800 IN NS ns2.digitalocean.com. domain1.ca. 1800 IN NS ns3.digitalocean.com. www.domain1.ca. 1800 IN CNAME domain1.ca. *.domain1.ca. 1800 IN A [ip]
domain2.com. IN SOA ns1.digitalocean.com. hostmaster.domain2.com. 1412268938 10800 3600 604800 1800 domain2.com. 1800 IN A [ip] domain2.com. 1800 IN NS ns1.digitalocean.com. domain2.com. 1800 IN NS ns2.digitalocean.com. domain2.com. 1800 IN NS ns3.digitalocean.com. www.domain2.com. 1800 IN CNAME domain2.com.
my nginx has those 2 configs:
server { server_name domain2.com www.domain2.com; … }
server { server_name domain1.ca www.domain1.ca; … }
My problem is that , if i go to whatever.domain1.ca, nginx leads to my domain2 config.
I tried to play with A and CNAME with no solution, any help?
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!
There is not a directive for wildcard subdomains, so you will be answer by first conf in line
server { server_name domain2.com www.domain2.com; … }
server { server_name domain1.ca www.domain1.ca; … }
it should be something around this lines:
server { server_name .domain2.com; … }
server { server_name .domain1.ca; … }
If you want to support additional subdomains or have your site act as a catch-all for subdomains in that domain you would want to update your server_name parameter to look like this:
server {
server_name domain1.ca www.domain1.ca *.domain1.ca;
...
}
The addition of the *.domain1.ca tells nginx to serve requests for any name that ends with domain1.ca.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.