1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Document Root vs Subdomains

Discussion in 'Apache' started by T0PS3O, Sep 13, 2005.

  1. #1
    Playing with my new server I keep running into trouble :)

    I'll give the support geeks some rest and bugger you guys instead this time :D

    It's RHEL v3.

    Here's my folder structure.

    /var/web/mydomain.com/public/www (this is the Virtual Server's document root for mydomain.com - load the www.mydomain.com in the browser and it resolves just fine).

    Hoewever, I also have:

    /var/web/mydomain.com/public/stats which is supposed to be stats.mydomain.com however, typing that into the browser won't resolve. My assumption that it should work by just organising it the way it used to be on my shared hosting account is obviously wrong.

    How do I set up subdomains on my own server? It used to be as easy as making a new folder in FTP but I haven't cracked it yet unfortunately.

    I'm feeling such a noob, finding things hard that used to be childsplay :(
     
    T0PS3O, Sep 13, 2005 IP
  2. forkqueue

    forkqueue Guest

    Messages:
    401
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I'm assuming you've already created a DNS entry for stats.yourdomain.com

    You need to set up an entry in Apache for it too. RHEL3 comes with Apache2 IIRC.
    You don't mention what stats program you're using, but it should be as simple as:

    
    <VirtualHost *:80>
            ServerName      stats.yourdomain.com
            DocumentRoot    /var/web/mydomain/public/stats
            <Directory "/var/web/mydomain/public/stats">
             Options        ExecCGI
             Order  allow,deny
             Allow from all
            </Directory>
    </VirtualHost>
    
    Code (markup):
    HTH
     
    forkqueue, Sep 13, 2005 IP
  3. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks!

    Do you use webmin? Under Servers, Apache, this particular server and then Directives I now see:

    DocumentRoot /var/web/mydomain.com/public/www
    ServerName mydomain.com
    <Directory "/var/web/mydomain.com">
    allow from all
    Options +Indexes
    AllowOverride All
    </Directory>
    Code (markup):
    Do I just add in your bit?
     
    T0PS3O, Sep 13, 2005 IP
  4. johnt

    johnt Peon

    Messages:
    178
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    0
    #4
    If you're using webmin you can use the "Create a new virtual server" form at the bottom of the Apache module page. The DocumentRoot and ServerName variables will be as forkqueue said.
     
    johnt, Sep 13, 2005 IP
  5. forkqueue

    forkqueue Guest

    Messages:
    401
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Never used webmin in my life I'm afraid, good ol vi is the only tool I need :D

    What johnt said would seem to make sense. The bit you pasted would be from your www.yourdomain.com virtual host - you want to create an entirely new one.
     
    forkqueue, Sep 13, 2005 IP
  6. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Seems like I just sussed it out with Webmin the way johnt explained.

    I complicated matters myself by not having a domain to the IP yet. So for the time being I'll use a folder down the root instead of a subdomain up the root.

    You learn something every day... http://subdomain.xxx.xxx.xx.xx doesn't work :) http://xxx.xxx.xx.xx/subfolder does :)
     
    T0PS3O, Sep 13, 2005 IP
  7. johnt

    johnt Peon

    Messages:
    178
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    0
    #7
    When you say that you don't have a domain to IP yet, I guess that you're waiting for the DNS changes to take effect and filter around the web.
    If you don't want to wait for this you can edit your hosts file to tell your PC that your new subdomain is on the specific IP address.
    If you're using windows, you can find your hosts file in c:\windows\system32\drivers\etc\hosts and you need to add a line like
    111.222.333.444 subdomain.domain.com
    Code (markup):
    I do this all the time when setting up new domains or subdomains.

    cheers

    John
     
    johnt, Sep 14, 2005 IP
  8. john_loch

    john_loch Rodent Slayer

    Messages:
    1,294
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    138
    #8
    You could of course just (crontab) copy the stats to your web root every 24 hours. That way you don't need a subdomain, or to pray that webmin is doing it's thing correctly..

    It also saves any mucking around with backups, it's all there in web root etc..

    Just a thought :)

    Cheers,

    JL
     
    john_loch, Sep 14, 2005 IP
  9. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #9
    It doesn't have it's own domain name yet because I'm not ready to move it but do want to set everything up. This one domain will have a whole lot of subdomains which are all restricted to office use (and those employees out and about).

    The webmin admin way to configure them is fine. Just seems a whole lot more complicated than I thought it'd be. Oh well :)
     
    T0PS3O, Sep 14, 2005 IP