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 want to setup Subdomains on my website used for various purpose. e.g. rc.mywebsite.com for Release Candidate, beta.mywebsite.com for Beta Candidate and www.mywebsite.com/mywebsite.com for Live version.

I am using Apache 2.2.22 with PHP and mod_rewrite enabled on Ubuntu 12.04LTS Server. In my /etc/apache2/sites-available I have a file mywebsite.com enabled using a2ensite mywebsite.com with entry as

<VirtualHost *:80>
    ServerAdmin webmaster@mywebsite.com
    ServerName mywebsite.com
    ServerAlias mywebsite.com
    DocumentRoot /var/www/mywebsite.com
    <Directory /var/www/mywebsite.com>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all

<VirtualHost *:80>
    ServerAdmin webmaster@mywebsite.com
    ServerName beta.mywebsite.com
    ServerAlias beta.mywebsite.com
    DocumentRoot /var/www/beta.mywebsite.com

My /etc/hosts file has       localhost
XX.XX.XX.XX     myotherwebsite.com
XX.XX.XX.XX     mywebsite.com
XX.XX.XX.XX     beta.mywebsite.com

Now the above this is Not working... :( I am only able to access mywebsite.com When I try to access beta.mywebsite.com I get Server not found Error.

share|improve this question
You haven't actually asked a question. –  ThatGraemeGuy May 24 '12 at 9:55
Now the above this is Not working... :( I am only able to access mywebsite.com –  Wh0RU May 24 '12 at 10:13

2 Answers 2

What exactly is the question ?

You should get rid of the duplicate ServerAlias, to begin with - it does nothing.

The first-listed vhost is the default; it will receive all requests that do not match any other vhosts.

Other than that, your vhosts look fine; just remember not to use overlapping documentroots.

share|improve this answer

Have you enabled NameVirtualHosts in your config? http://httpd.apache.org/docs/2.2/mod/core.html#namevirtualhost

The NameVirtualHost directive is a required directive if you want to configure name-based virtual hosts...

To receive requests on all interfaces, you can use an argument of *:80, or, if you are listening on multiple ports and really want the server to respond on all of them with a particular set of virtual hosts, *

For example:

NameVirtualHost *:80

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.