Results 1 to 4 of 4

Thread: Apache2 virtualhosts

  1. #1

    Default Apache2 virtualhosts

    I've got a Novell exercise I'm busy doing where I need to setup an apache2 site called www. digitalairlines. com and 2 virtual sites hr.digitalairlines.com and marketing.digitalairlines.com

    I've installed apache and got the www. digitalairlines. com going - easy enough with a index.html under /srv/www/htdocs - this works fine.

    I then create a hr.conf and marketing.conf file under /etc/apache2/vhosts.d

    hr.conf
    Code:
    <VirtualHost *:80>
        ServerAdmin webmaster@hr.digitalairlines.com
        ServerName hr.digitalairlines.com
        DocumentRoot /srv/www/vhosts/hr
        ErrorLog /var/log/apache2/hr.digitalairlines.com-error_log
        CustomLog /var/log/apache2/hr.digitalairlines.com-access_log combined
    
        HostnameLookups Off
        UseCanonicalName Off
        ServerSignature On
    
        ScriptAlias /cgi-bin/ "/srv/www/vhosts/hr/cgi-bin/"
    
        <Directory "/srv/www/vhosts/hr/cgi-bin">
            AllowOverride None
            Options +ExecCGI -Includes
            Order allow,deny
            Allow from all
        </Directory>
    
        <IfModule mod_userdir.c>
            UserDir public_html
            Include /etc/apache2/mod_userdir.conf
        </IfModule>
    
       <Directory "/srv/www/vhosts/hr">
            Options Indexes FollowSymLinks
            AllowOverride None
            Order allow,deny
            Allow from all
    
        </Directory>
    
    </VirtualHost>
    If I now got to hr.digitalairlines.com and marketing.digitalairlines.com the correct index.html is displayed. However if I go to www. digitalairlines. com I see the marketing web page displayed. Any ideas as to why this is occurring?

    My default-server.conf file:

    Code:
    DocumentRoot "/srv/www/htdocs"
    <Directory "/srv/www/htdocs">
            Options None
            AllowOverride None
            Order allow,deny
            Allow from all
    </Directory>
    
    Alias /icons/ "/usr/share/apache2/icons/"
    
    <Directory "/usr/share/apache2/icons">
            Options Indexes MultiViews
            AllowOverride None
            Order allow,deny
            Allow from all
    </Directory>
    
    ScriptAlias /cgi-bin/ "/srv/www/cgi-bin/"
    <Directory "/srv/www/cgi-bin">
            AllowOverride None
            Options +ExecCGI -Includes
            Order allow,deny
            Allow from all
    </Directory>
    
    <IfModule mod_userdir.c>
            UserDir public_html
            Include /etc/apache2/mod_userdir.conf
    </IfModule>
    Include /etc/apache2/conf.d/*.conf
    Include /etc/apache2/conf.d/apache2-manual?conf

  2. #2
    Join Date
    Jun 2008
    Location
    Groningen, Netherlands
    Posts
    19,644
    Blog Entries
    14

    Default Re: Apache2 virtualhosts

    Please, post contents of marketing.conf as well.
    ° Appreciate my reply? Click the star and let me know why.

    ° Perfection is not gonna happen. No way.

    https://en.opensuse.org/openSUSE:Board#Members
    http://en.opensuse.org/User:Knurpht
    http://nl.opensuse.org/Gebruiker:Knurpht

  3. #3

    Default Re: Apache2 virtualhosts

    Marketing.conf

    Code:
    <VirtualHost *:80>
        ServerAdmin webmaster@marketing.digitalairlines.com
        ServerName marketing.digitalairlines.com
    
        DocumentRoot /srv/www/vhosts/marketing
    
        ErrorLog /var/log/apache2/marketing.digitalairlines.com-error_log
        CustomLog /var/log/apache2/marketing.digitalairlines.com-access_log combined
        HostnameLookups Off
    
        UseCanonicalName Off
        ServerSignature On
        ScriptAlias /cgi-bin/ "/srv/www/vhosts/marketing/cgi-bin/"
    
        <Directory "/srv/www/vhosts/marketing/cgi-bin">
            AllowOverride None
            Options +ExecCGI -Includes
            Order allow,deny
            Allow from all
        </Directory>
    
        <IfModule mod_userdir.c>
            UserDir public_html
            Include /etc/apache2/mod_userdir.conf
        </IfModule>
    
        <Directory "/srv/www/vhosts/marketing">
            Options Indexes FollowSymLinks
            AllowOverride None
            Order allow,deny
            Allow from all
    
        </Directory>
    
    </VirtualHost>

  4. #4
    Join Date
    Jun 2008
    Location
    Cambridge, United Kingdom
    Posts
    7

    Default Re: Apache2 virtualhosts

    On 22/05/2012 10:16, gmccarthy wrote:

    > I've got a Novell exercise I'm busy doing where I need to setup an
    > apache2 site called www. digitalairlines. com and 2 virtual sites
    > hr.digitalairlines.com and marketing.digitalairlines.com
    >
    > I've installed apache and got the www. digitalairlines. com going -
    > easy enough with a index.html under /srv/www/htdocs - this works fine.
    >
    > I then create a hr.conf and marketing.conf file under
    > /etc/apache2/vhosts.d
    >
    > hr.conf


    ...snip..

    > If I now got to hr.digitalairlines.com and
    > marketing.digitalairlines.com the correct index.html is displayed.
    > However if I go to www. digitalairlines. com I see the marketing web
    > page displayed. Any ideas as to why this is occurring?
    >
    > My default-server.conf file:


    ...snip..

    Whilst you've created configuration files to set up virtual hosts for
    hr.digitalairlines.com and marketing.digitalairlines.com you don't
    appear to have set up a virtual host for www.digitalairlines.com itself.

    Since www.digitalairlines.com is not defined as a virtual host the first
    defined virtual host is used as the default (though since h comes before
    m in the alphabet I would expect hr.conf to be processed before
    marketing.conf thus becoming the default).

    See http://httpd.apache.org/docs/2.2/vhosts/name-based.html for more
    information on name-based virtual hosts.

    HTH.
    --
    Simon
    Novell/SUSE/NetIQ Knowledge Partner

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •