Subdomains Using Apache Virtual Host

I want to set up subdomains on my website, used for different purposes. for example, rc.mywebsite.com for a candidate for release, beta.mywebsite.com for a candidate for beta, and www.mywebsite.com/mywebsite.com for a live version.

I am using Apache 2.2.22 with PHP and mod_rewrite is enabled on the Ubuntu 12.04LTS server. In my / etc / apache 2 / sites-available I have the file mywebsite.com included using a2ensite mywebsite.com with the 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
    </Directory>
</VirtualHost>

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

In my / etc / hosts file there is

127.0.0.1       localhost
XX.XX.XX.XX     myotherwebsite.com
XX.XX.XX.XX     mywebsite.com
XX.XX.XX.XX     beta.mywebsite.com

Now this does not work above ... :( I can only access mywebsite.com When I try to access beta.mywebsite.com, I get Server not found .

+5
4

VirtualHost beta.mywebsite.com.

$a2ensite beta.mywebsite.com ; service apache2 reload

.

+2

, . , , , .

<Directory> ... </Directory> /var/www/beta.mywebsite.com?

: http://wiki.apache.org/httpd/CommonMisconfigurations

+1

?

ServerName beta.mywebsite.com
<VitualHost...

VirtualHost.

ServerAlias beta.mywebsite.com

, . , , beta.mywebsite.org ..

0

try copying the .conf file from the / etc / apache / sites -available folder to the / etc / apache / sites folder and then restart apache

-2
source

All Articles