subdomain problem solved - maybe.

2 posts / 0 new
Last post
#1 Fri, 10/02/2015 - 07:25
eddiemat

subdomain problem solved - maybe.

I've spent most of the day trying to get a subdomain working. It is clear I'm not the only one struggling with this stuff. Much of the stuff I've found searching has been out of date and it is hard to get an overview of what is what. Answers to simple questions like - do I need my own DNS and do I need BIND aren't obvious.

This is roughly my situation. I'm moving from a managed VPS with cpanel WHM etc to a cloud based server I had to set up myself (ubuntu trusty). The old VPS was set for me and and had a help-desk. It had its own nameserver and Cpanel did all the magic of setting up zones and so forth. You don't know how much magic is being done for you till you have to do it yourself.

So I've moved a bunch of accounts across and they are mostly working. Then I noticed none of my subdomains work.

Searching the web on the topic you find talk of BIND servers and running a DNS and so forth.

So I have a domain we'll call domain.com and it has a subdomain sub.domain.com

subdomain sub.domain.com is an alias for domain.com both should point to public_html. domain.com worked and sub.domain.com gave a server not found.

The hosting company (binarylane) provide the DNS. Adding a "A" record for subdomain or using an "A" record with wildcard "*" solves the "server not found" issue.

It becomes a "Forbidden - You don't have permission to access / on this server." issue.

I looked at every webmin/virtualmin setting I could find but no joy. I enabled BIND and ran a conf check which gave me a page full of extra errors to worry about.

Back to webmin apache and clicked on sub.domain.com In the "Per-Directory Options" I saw the directory was wrong. Instead of /home/user/public_html/ it had /home/user/public_html/subdomain

I fixed it and restarted apache - another dissapointment - no change.

Then just searching the file system I found a file in /etc/apache2/sites-available it had the form subdomain sub.domain.com.conf This had a line DocumentRoot /home/user/public_html/subdomain I changed this to /home/user/public_html/ restarted apache and my page loaded.

I don't know if this is a bug or what. If this can be fixed from the webmin GUI I couldn't manage it.

So it appears to work with BIND turned off and no DNS on my server. I hope this helps someone.

Fri, 10/02/2015 - 08:03
eddiemat

After writing the above the page stopped working. This may have been because I'd left a trailing "/" in "Per-Directory Options" directory.

It seems this setting is important. There might be some sort of lag between making changes and the effect. (later) It looks like the directory needs to be correct in both places for it to work. I've "fixed" 3 subdomains now and that seems to be what is required.

Topic locked