Howto: Virtual hosts on Bubba

A collection of tips on howto tweak your Bubba.

Howto: Virtual hosts on Bubba

Postby tor » 06 Nov 2007, 12:01

For each "subdomain" you should create a file in

/etc/apache2/sites-available

The file, lets call it app1, /etc/apache2/sites-available/app1. Should look something like this (Minimal example):
Code: Select all
<VirtualHost *:80>
        ServerName app1.my.dyndns.com
        DocumentRoot /var/www/app1
        ServerAdmin webmaster@my.dyndns.com

        ErrorLog /var/log/apache2/app1_error.log
        LogLevel warn
        CustomLog /var/log/apache2/app1.log combined
        ServerSignature On
</VirtualHost>


<VirtualHost *:443>
       
        ServerName app1.my.dyndns.com
        DocumentRoot /var/www/cool
        ServerAdmin webmaster@my.dyndns.com

        SSLEngine on
        SSLCertificateFile      /etc/apache2/my_cert.pem
        SSLCertificateKeyFile   /etc/apache2/my_privkey.pem

        ErrorLog /var/log/apache2/app1_error.log
        LogLevel warn
        CustomLog /var/log/apache2/app1.log combined
        ServerSignature On
</VirtualHost>


Where DocumentRoot points to the web root directory or web application install.

Make sure that DynDNS, or other DNS, is updated with pointers for app1.my.dyndns.com.

Enable the site on bubba

Code: Select all
a2ensite app1


Reload configurations in apache

Code: Select all
/etc/init.d/apache2 reload


Now apache should show your web-app when you direct your web browser to app1.my.dyndns.com.
tor
Site Admin
 
Posts: 699
Joined: 06 Dec 2006, 19:24

Re: Howto: Virtual hosts on Bubba

Postby ahoff » 17 May 2010, 20:07

Anyone understands why http://havsnas.se goes to the bubba-admin page, whilest http://www.havsnas.se works as it is supposed to?

Code: Select all
    <VirtualHost *:80>
            ServerName www.havsnas.se
            ServerAlias havsnas.se
            DocumentRoot /home/mrx/www
            ServerAdmin webmaster@havsnas.se

            ErrorLog /var/log/apache2/app1_error.log
            LogLevel warn
            CustomLog /var/log/apache2/app1.log combined
            ServerSignature On
    </VirtualHost>


    <VirtualHost *:443>
           
            ServerName www.havsnas.se
            DocumentRoot /home/mrx/www
            ServerAdmin webmaster@havsnas.se

            SSLEngine on
            SSLCertificateFile      /etc/apache2/my_cert.pem
            SSLCertificateKeyFile   /etc/apache2/my_privkey.pem

            ErrorLog /var/log/apache2/app1_error.log
            LogLevel warn
            CustomLog /var/log/apache2/app1.log combined
            ServerSignature On
    </VirtualHost>
Åke Hoff
Falun, Swe
ahoff
 
Posts: 58
Joined: 02 Apr 2008, 02:50
Location: Falun, Sweden

Re: Howto: Virtual hosts on Bubba

Postby PerN » 02 Jun 2010, 11:17

ahoff wrote:Anyone understands why http://havsnas.se goes to the bubba-admin page, whilest http://www.havsnas.se works as it is supposed to?


I'd expect the NameVirtualHost directive to be required (though it isn't mentioned in the HowTo).

That is
Code: Select all
    NameVirtualHost *:80

    <VirtualHost *:80>
            ServerName www.havsnas.se
            ServerAlias havsnas.se
            DocumentRoot /home/mrx/www
     
        ...etc
PerN
 
Posts: 18
Joined: 20 May 2010, 21:07


Return to Howtos

Who is online

Users browsing this forum: No registered users and 1 guest

cron