Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

I have a server that hosts mydomain.com. Then I have a server that hosts subdomain1.mydomain.com.

On the subdomain1.mydomain.com server, how do I make subdomains? For instance I want to create subdomain2.subdomain1.mydomain.com

I have my subdomain1.mydomain.com site in /home/USER/public_html and it is working just fine. But When I try to create subdomain2.subdomain1.mydomain.com, it says Server not found in the browser. I have tried so many configurations in my /etc/hosts and /etc/apache2/sites-available/subdomain2.subdomain1.mydomain.com, without any luck

Can I get some detailed instructions maybe? I have looked everywhere and every place tells you different, with no luck.

Ubuntu Server 11.10 w/ the Lamp Stack option

share|improve this question
What software/service provides the answers for subdomain1.mydomain.com? –  user8290 Dec 6 '11 at 21:48
I am not sure what you mean. Could you explain that more? –  joe Dec 6 '11 at 22:08
Hard to know, can you pastebin your /etc/hosts as well as your configuration files. –  bodhi.zazen Dec 6 '11 at 22:09
/etc/hosts: pastebin.com/kAd2tvtc –  joe Dec 6 '11 at 22:35
/etc/apache2/sites-available/subdomain.domain.com: pastebin.com/a9j4gXXQ –  joe Dec 6 '11 at 22:39

1 Answer 1

You should put your subdomain2 DocumentRoot in your /etc/apache2/sites-available/default like this:

<VirtualHost *:90>
    ServerName subdomain2.subdomain.1.com
    DocumentRoot /home/USER/public_html
    <Directory /home/USER/public_html/>
        Options FollowSymLinks
        AllowOverride All
share|improve this answer
You shouldn't put it in the default, that's really not a best practice for multiple virtual hosting –  Marco Ceppi Mar 5 '12 at 14:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.