Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a ubuntu 10.04 server that is currently setup only to run a single website. I would like to setup a subdomain to point to specific section of this website. For example, I want test.example.com to point to example.com/testing. What is the best way to make this happen?

share|improve this question
Can you clarify what behavior you're looking to achieve? "point to" is vague; are you looking to redirect, serve the content from the subdomain transparently, or something else? And can you provide more information about your current configuration? Ubuntu's default configuration uses virtual hosts - have you removed those? –  Shane Madden Aug 29 '12 at 2:51
I want to have test.example.com load the webpage at /var/www/test. Where as example.com typically just loads /var/www. I installed apache2 and made no modifications to it. So however it is by default is how I have it set up currently. –  Mitch Aug 29 '12 at 4:39

1 Answer 1

Create a new vhost:

touch /etc/apache2/sites-available/test.example.com

Give it some content:

<VirtualHost *:80>
    ServerName test.example.com
    DocumentRoot /var/www/test
    # ..any other config needed
    <Directory /var/www/test>
        Order Allow,Deny
        Allow from all

Enable it:

a2ensite test.example.com

And restart Apache:

service apache2 restart

Make sure name resolution for the new test.example.com name is pointing to your server correctly.

share|improve this answer

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.