Howto: Virtual hosts on Bubba

A collection of tips on howto tweak your Bubba.
Post Reply
tor
Posts: 703
Joined: 06 Dec 2006, 12:24
Contact:

Howto: Virtual hosts on Bubba

Post by tor » 06 Nov 2007, 05: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.

ahoff
Posts: 87
Joined: 01 Apr 2008, 20:50
Location: Swe

Re: Howto: Virtual hosts on Bubba

Post by ahoff » 17 May 2010, 14: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
Örskogen
Sweden

PerN
Posts: 28
Joined: 20 May 2010, 15:07

Re: Howto: Virtual hosts on Bubba

Post by PerN » 02 Jun 2010, 05: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

amishorn
Posts: 21
Joined: 29 Feb 2012, 12:32
Location: Switzerland

Re: Howto: Virtual hosts on Bubba

Post by amishorn » 04 Apr 2014, 18:07

Hi all

Firstly, I wanna thank you for this clear guideline.
However, I struggle a bit by updating the subdomain address to the point of the webfolder. I am using the myownb3.com service from excito. And for me it is definitively not clear how I could update that point. First, I thought I have only to update the entire subdomain address to the "default" webfolder, but that even doesn't work.
I would really appreciate if anyone can explain me how I can update that service, so that also can use the subdomain address. Or is it simply not possible with the myownb3 service?

Thanks,
amishorn

Gordon
Posts: 1367
Joined: 10 Aug 2011, 03:18

Re: Howto: Virtual hosts on Bubba

Post by Gordon » 05 Apr 2014, 03:53

Did you read this howto as well?

As for mapping your myownb3.com domain, you simply set ServerName to <yourname>.myownb3.com and DocumentRoot to the directory where you stored the files you want to publish when people access this particular server name. Do note that Apache is picky about the order that you define the vhosts (it's explained in that other howto).

Post Reply