Report this

What is the reason for this report?

Second subdomain NOT working

Posted on June 27, 2014

I used the wild card CNAME * @ DNS entry and my root domain.com and sub1.domain.com are accessible (on the same droplet). But if I try to access sub2.domain.com, after web server configuration, it takes me to sub1.domain.com. I’m using NginX server blocks and all domains are using the same IP address. (I’ve configured domain.com on 80 while I access/configure subs like sub1.domain.com:8088 and sub2.domain.com:8088)

phpmyadmin: http://pastebin.com/gjsf0tYZ piwik: http://pastebin.com/DQLCjKqX

My /etc/hosts:

127.0.0.1   localhost mydomain

::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Hitting in the browser phpmyadmin.mydomain.com:8088 works fine but hitting stats.mydomain.com:8088 takes me to phpmyadmin login page. Do I need to create A records for more than 1 sub.domain.com?



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!

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.

No, the wildcard CNAME should be fine. There seems to be some other issue. Perhaps something like the host header not being properly retained. From the docs: Nginx checks

the header field “Host” to determine which server the request should be routed to. If its value does not match any server name, or the request does not contain this header field at all, then nginx will route the request to the default server for this port.

Did you edit /etc/nginx/fastcgi_params at all?

Thanks @astarr for replying. I did not change fastcgi_params and I’m still trying to figure out the problem…

It might be easier to get a control panel to handle the virtual hosts.

These are some popular ones: https://vestacp.com http://www.webmin.com

I’ve gotten subdomains to work in just a few minutes using Vesta CP, as long as the nameserver for your domain is set to use your server’s dns.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.