New user's registration have been closed due to high spamming and low trafic on this forum. Please contact forum admins directly if you need an account. Thanks !

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 »

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: 105
Joined: 01 Apr 2008, 20:50
Location: Swe

Re: Howto: Virtual hosts on Bubba

Post by ahoff »

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 »

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 »

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: 1461
Joined: 10 Aug 2011, 03:18

Re: Howto: Virtual hosts on Bubba

Post by Gordon »

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