Results 1 to 5 of 5

Thread: Subdomain on LAN

  1. #1
    Join Date
    Oct 2007
    Beans
    6

    Subdomain on LAN

    Hi all,

    I am new to this and have installed Ubuntu Server 7.10 i386 edition. I am trying to create subdomains to be accessible by other computers on the network.

    I have the following setup:
    - PC with Ubuntu Server 7.10 i386 installed
    - Laptops, both Windows and Mac's

    I can:
    - From the laptops access the server through http://192.168.2.200 and it directs me to my index.htm that i setup.

    I want to:
    - From the laptops access subdomains on the server, http://diamonds.192.168.2.200 ??? If this is fundamentally wrong, what alternative do I have to produce something of similar results? When i attempt to access http://diamonds.192.168.2.200 I get "Server not found" message

    I don't want to:
    - Have subfolders, EG. http://192.168.2.200/diamonds, http://192.168.200/pearls etc

    What I have tried:
    - http://thinkingnectar.com/2008/getti...-in-localhost/
    - http://ubuntuforums.org/showthread.p...able+subdomain

    What is all this for?
    - I am trying to make a few websites that will be accessed through subdomains, eg http://diamonds.domainname.com and http://pearls.domainname.com, however, i don't yet have a domain name registered. I intend on purchasing this AFTER i get my websites up and running.

    What am I doing wrong guys? A pointer in the right direction and any help will be greatly appreciated.

    My current settings:
    Directory: /etc/apache2/sites-available$
    Files: default websites
    default
    Code:
    NameVirtualHost *
    <VirtualHost *>
            ServerAdmin webhost@gmail.com
    
            DocumentRoot /var/www/domain.com
            <Directory />
                    Options FollowSymLinks
                    AllowOverride None
            </Directory>
            <Directory /var/www/>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride None
                    Order allow,deny
                    allow from all
                    # This directive allows us to have apache2's default start page
                    # in /apache2-default/, but still have / go to the right place
                    #RedirectMatch ^/$ /apache2-default/
            </Directory>
           </Directory>
    
            ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
                       "/usr/lib/cgi-bin">
            DocumentAllowOverride None
            <DirectoOptions +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                    Options FollowSymLinks
                    AllowOverride None
            </Directory>
    
            ErrorLog /var/log/apache2/error.lognks MultiViews
                    AllowOverride None
            # Possible values include: debug, info, notice, warn, error, crit,
            # alert, emerg.rom all
            LogLevel warns directive allows us to have apache2's default start page
                    # in /apache2-default/, but still have / go to the right place
            CustomLog /var/log/apache2/access.log combined
            ServerSignature On
            ServerSignature On
    
        Alias /doc/ "/usr/share/doc/"
        <Directory "/usr/share/doc/">
            Options Indexes MultiViews FollowSymLinks
            AllowOverride None
            Order deny,allow
            DenyOverride None
            Allow from 127.0.0.0/255.0.0.0 ::1/128
        </Directory>
    
    </VirtualHost>  AllowOverride None
    
    
    
                    # in /apache2-default/, but still have / go to the right place
    websites
    Code:
    # localhost
    <VirtualHost 127.0.0.1>
            DocumentRoot /var/www/domain.com/
    </VirtualHost>
    
    # pearls
    <VirtualHost 127.0.0.2>
            DocumentRoot /var/www/pearls/
    </VirtualHost>
    
    # diamonds
    <VirtualHost 127.0.0.3>
            DocumentRoot /var/www/diamonds/
    </VirtualHost>
    directory: /etc/apache2/sites-enabled$
    files: 000-default domain.com pearls diamonds

    domain.com
    Code:
    NameVirtualHost *
    <VirtualHost *>
            ServerAdmin webhost@gmail.com
            ServerName domain.com
            ServerAlias www.domain.com
    
            DocumentRoot /var/www/domain.com
            <Directory />
                    Options FollowSymLinks
                    AllowOverride None
            </Directory>
            <Directory /var/www/>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride None
                    Order allow,deny
                    allow from all
                    # This directive allows us to have apache2's default start page
                    # in /apache2-default/, but still have / go to the right place
                    #RedirectMatch ^/$ /apache2-default/
            </Directory>
    
            ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
            <Directory "/usr/lib/cgi-bin">
                    AllowOverride None
                    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                    Order allow,deny
                    Allow from all
            </Directory>
    
            ErrorLog /var/log/apache2/error.log
    
            # Possible values include: debug, info, notice, warn, error, crit,
            # alert, emerg.
            LogLevel warn
    
            CustomLog /var/log/apache2/access.log combined
            ServerSignature On
    
        Alias /doc/ "/usr/share/doc/"
        <Directory "/usr/share/doc/">
            Options Indexes MultiViews FollowSymLinks
            AllowOverride None
            Order deny,allow
            Deny from all
            Allow from 127.0.0.0/255.0.0.0 ::1/128
        </Directory>
    
    </VirtualHost>
    pearls
    Code:
    <VirtualHost *> 
            DocumentRoot /var/www/pearls/
            ServerName pearls.localhost
    
            <Directory /var/www/pearls/>
                    Options Indexes FollowSymLinks MultiViews +Includes
                    AllowOverride None
                    Order allow,deny
                    allow from all
            </Directory>
    </VirtualHost>
    diamonds
    Code:
    <VirtualHost *>
            DocumentRoot /var/www/diamonds/
            ServerName diamonds.localhost
    
            <Directory /var/www/diamonds/>
                    Options Indexes FollowSymLinks MultiViews +Includes
                    AllowOverride None
                    Order allow,deny
                    allow from all
            </Directory>
    </VirtualHost>
    directory: /etc/apache2$

    httpd.conf
    Code:
    <VirtualHost *>
    ServerName localhost
    DocumentRoot /var/www/domain.com
    </VirtualHost>
    
    <VirtualHost *>
    ServerName pearls.localhost
    DocumentRoot /var/www/pearls/
    </VirtualHost>
    
    <VirtualHost *>
    ServerName diamonds.localhost
    DocumentRoot /var/www/diamonds/
    </VirtualHost>
    Directory: /var/www$
    Folders: apache2-default diamonds domain.com pearls


    Thanks in advance,

    David

  2. #2
    Join Date
    Feb 2006
    Location
    Europe
    Beans
    25

    Re: Subdomain on LAN

    First of all, using subdomains depends on the request the browsers sends to the webserver.

    Try to setup a fictive domain name on your webserver and your clients.

    Steps:
    Edit your hosts file on the clients to trick them into thinking the domain and subdomains really exist and point to 192.168.2.200.

    On Windows:

    - find your hosts file: http://lunarsoft.net/forum/index.php?showtopic=1153
    - Edit it and add entries for your subdomains, eg:

    192.168.2.200 pearl.domain.com
    192.168.2.200 subdomain2.domain.com

    If you have this working you will be able to setup your subdomains in your apache config using the ServerName directive.


    Example:
    NameVirtualHost 192.168.2.200:80

    <VirtualHost 192.168.2.200>
    ServerName pearls.domain.com
    DocumentRoot /var/www/pearls/
    </VirtualHost>

  3. #3
    Join Date
    Oct 2007
    Beans
    6

    Wink Re: Subdomain on LAN

    geertn,

    Thanks so much.

    I added the following entries to my client host files:
    Code:
    192.168.2.200 domain.com
    192.168.2.200 pearls.domain.com
    192.168.2.200 diamonds.domain.com
    I then changed my httpd.conf to look like:
    Code:
    <VirtualHost *>
    ServerName ephalent.com.au
    DocumentRoot /var/www/ephalent.com.au
    </VirtualHost>
    
    <VirtualHost *>
    ServerName pearls.ephalent.com.au
    DocumentRoot /var/www/pearls/
    </VirtualHost>
    
    <VirtualHost *>
    ServerName diamonds.ephalent.com.au
    DocumentRoot /var/www/diamonds/
    </VirtualHost>
    However, I didn't understand the reasons for the additional content you asked me to put in and removed them because I received the following errors:
    Additional content
    Code:
    NameVirtualHost 192.168.2.200:80
    <VirtualHost 192.168.2.200>
    Errors
    Code:
    [Fri Apr 25 10:20:39 2008] [error] VirtualHost 192.168.2.200:0 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results
    [Fri Apr 25 10:20:39 2008] [error] VirtualHost 192.168.2.200:0 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results
    [Fri Apr 25 10:20:39 2008] [error] VirtualHost 192.168.2.200:0 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results
    [Fri Apr 25 10:20:39 2008] [warn] NameVirtualHost *:0 has no VirtualHosts
    [Fri Apr 25 10:20:49 2008] [error] VirtualHost 192.168.2.200:0 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results
    [Fri Apr 25 10:20:49 2008] [error] VirtualHost 192.168.2.200:0 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results
    [Fri Apr 25 10:20:49 2008] [error] VirtualHost 192.168.2.200:0 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results
    [Fri Apr 25 10:20:49 2008] [warn] NameVirtualHost *:0 has no VirtualHosts
    I will try and dig up what I can find about these before I lodge another post though. Might have to read up on the Apache2 manual

    Thanks for your help once again.

    Kind regards,
    David

  4. #4
    Join Date
    Jan 2005
    Location
    South Africa
    Beans
    2,098
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Subdomain on LAN

    Below my vhosts config (from a Slackware 12 server)
    Code:
    #
    # Use name-based virtual hosting.
    #
    NameVirtualHost *:80
    
    # catch-all
    <VirtualHost *:80>
        ServerAdmin admin@btd-techweb
        DocumentRoot /srv/httpd/htdocs
        ServerName btd-techweb02
    </VirtualHost>
    
    # site 1
    <VirtualHost *:80>
        ServerAdmin admin@btd-techweb
        DocumentRoot /home/wim/www/site1/web
        ServerName site1.btd-techweb02
        ErrorLog /var/log/httpd/error_log
        CustomLog /var/log/httpd/access_log common
    
    #WimS
    # this is required to prevent message 403 "Forbidden"
        <Directory "/home/wim/www/site1/web">
            Order allow,deny
            Allow from all
        </Directory>
    </VirtualHost>
    
    # site2
    <VirtualHost *:80>
        ServerAdmin admin@btd-techweb
        DocumentRoot /home/wim/www/site2/web
        ServerName site2.btd-techweb02
        ErrorLog /var/log/httpd/error_log
        CustomLog /var/log/httpd/access_log common
    
    #WimS
    # this is required to prevent message 403 "Forbidden"
        <Directory "/home/wim/www/site2/web">
            Order allow,deny
            Allow from all
        </Directory>
    </VirtualHost>
    Hope it helps
    If you don't make backups of your important data, your data is obviously not important to you.

  5. #5
    Join Date
    May 2006
    Beans
    20

    Re: Subdomain on LAN

    Did you solve your NameVirtualHost error message problem? If not, see if this solution helps:
    http://apachehelp.blogspot.com/2008/...n-apache2.html

Bookmarks

Posting Permissions

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