Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2001
    Location
    Indianapolis, IN
    Posts
    175

    How do I setup: sub domain forward to user folder

    I know this has been answered before but I can't find it and now I need to use this. I want to setup a sub domain that forwards to the user's folder.

    Example:

    I add user1

    user1 site is http://www.mydomain.com/~user1

    I want to set it up so http://user1.mydomain.com redirects to http://www.mydomain.com/~user1

    can this be automated as I add new users or do I need to drop a line in the config files of the server.

    This is on a Cobalt RaQ3.

    Thanks in advance...
    David Smith

  2. #2
    First, Add the A Record to your DNS, or to who ever is maintaining DNS for you.

    Then, Add this to the httpd.conf and restart the httpd

    <VirtualHost xxx.xxx.xxx.xxx>

    ServerName sub.domain.com

    ServerAdmin admin

    DocumentRoot /home/sites/www.domain.com/sub-domains/test/

    AddHandler cgi-wrapper .cgi

    AddHandler cgi-wrapper .pl

    AddHandler server-parsed .shtml

    AddType text/html .shtml

    </VirtualHost>

  3. #3
    Join Date
    Mar 2001
    Location
    Indianapolis, IN
    Posts
    175
    Wouldn't this require an IP for each one and isn't there an easier way to do a rewrite or something that reconizes the sub domain and rewrites that to a folder?

    I remember this in the past and it seemed easier then this method. If I can't find another way I'll try this. I just hope it doesn't take an IP for each each one.
    David Smith

  4. #4
    No itís not required to have more then one IP address for subdomains.
    I don't know aboud an easier way to do this.
    Maybe some other peoples on this forum have comments?

  5. #5
    Join Date
    Apr 2002
    Posts
    384
    a good help for sush questions:
    http://www.raqsetup.com/faq.htm

  6. #6
    Join Date
    Aug 2001
    Location
    Atlanta
    Posts
    1,167
    zbco
    WHT Addict

    Registered: Apr 2001
    Posts: 157
    Couldn't find it in the forum again
    HI

    This is something I saved from WHT months ago....

    This makes a http://subdomain.xxx.xxx point to http://xxx.xxx/subdomain





    quote:
    --------------------------------------------------------------------------------

    Yes it can.

    I did a post on the cobalt users group for adding additional domains, which can include sub domains. Also how to set up email, so here it is:


    I am going to explain how to point one domain to a dirctory of any exsisting site. Also share the same email!

    Bear in mind that editing system files technically invalidates your
    warranty (but then how can anyone administer a Raq properly without editing system files....).

    I have found that you SHOULD NOT make your entries in httpd.conf!

    You should make a extra config file out side of your httpd.conf file.
    The reason I am explaining it this way is so if you add sites
    via your control panel in the future you don't run the risk off wiping out any mods you may have made.

    You will make ONE addition to the http.conf file and that is all.

    You will not need to make a virtual site with the control panel
    at all. You will need to add the DNS setting via your control panel
    though.

    Now here we go, ready?

    First off, decide what IP # you want the domain to use, for example lets say it is 123.123.123.123

    Go into your admin control panel, click control panel button, click
    parameters for your domain name system, add your (A) records.

    For example lets call the domain name secondsite.com

    Now add the domain name that you are going to use to point to another directory of a fully set up site on your Raq, with the IP you decided to use, this don't have to be the same IP as the first site. Add 2 (A) records here, one with the "www" and one with out. While you are at it add a MX record I will explain how to set point email at another site to, lets get the domain name working first.

    You should have:
    secondsite.com -> 123.123.123.123
    www.secondsite.com -> 123.123.123.123
    secondsite.com Very-High priority secondsite.com

    Save the domain name by clicking "Save changes to the DNS Server"

    Go back to the control panel then click "Save Changes"

    YOU ARE NOW DONE IN THE CONTROL PANEL TIME TO HEAD TO TELNET!

    Telnet into your raq using you admin username and password.

    when you get to the prompt type:

    su -

    it will ask for a password, normally this would be your admin
    password again. After this, should be logged into your raq via
    telnet as root.

    Back up to the "root" of the drive by typing:
    cd /

    Back up your httpd.cong file by typing:
    cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.backup

    Now change to the directory /etc/httpd/conf by typing:
    cd /etc/httpd/conf

    Now here is where you will make your ONE change to the
    httpd.conf file.

    Edit the file by typing:

    pico httpd.conf

    You should now be in the pico text editor, hold down your
    control key and hit V until you get all the way to the very
    bottom and add this line:

    Include /etc/httpd/conf/extra.conf

    Make sure I in include is capitalized.

    hold down your control key again and hit X, it should ask
    if you want to save the file, say yes.

    Now, lets make your "extra" config file. Just as the line I
    told you to add to the httpd.conf file, lets name this file
    extra.conf (your "extra" domains, the way I phrase it)

    type:

    touch extra.conf

    This creates a blank, empty file called extra.conf

    Now open that file up in PICO!!

    Type:

    pico extra.conf

    In here you will add the setting for your extra domains.

    You need to add the following, but first you will need
    the actual site number of the domain you want to point the
    second domain to, let for example say it is site52 and the
    directory name is called "other"

    Now add the following, but between {HTTP_HOST} AND !^123.123 use the TAB key. {CBT NOTE: 2 TABS, ON NEXT TWO LINES AS WELL} The following also has to look just like this, none of these lines can wrap to the next line or it will cause errors:

    <VirtualHost 123.123.123.123>
    ServerName www.secondsite.com
    ServerAdmin admin
    DocumentRoot /home/sites/site52/web/other
    ServerAlias secondsite.com
    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^123.123.123.123(:80)?$
    RewriteCond %{HTTP_HOST} !^www.secondsite.com (:80)?$
    RewriteRule ^/(.*) http://www.secondsite.com/$1 [L,R]
    RewriteOptions inherit
    AddHandler cgi-wrapper .cgi
    AddHandler cgi-wrapper .pl
    AddHandler server-parsed .shtml
    AddType text/html .shtml
    </VirtualHost>

    (Just a quick note, when I do this, I suggest that the user
    add a pop/ftp account and I point the second domain name there,
    in this case if you create a username "jdoe" you could use this in
    the above instruction:
    "DocumentRoot /home/sites/site52/users/jdoe/web"
    This keeps the second site in its own area all together and you can give their own FTP access, they can't use FrontPage though, unless someone else knows how to do this)

    There, now hold down your control key and hit X, and save the file.

    Now lets get this to work. You will have to restart httpd!

    Do this by typing:

    cd /

    then type:
    /etc/rc.d/init.d/httpd stop

    wait a few seconds then type:
    /etc/rc.d/init.d/httpd start

    You could just type:
    /etc/rc.d/init.d/httpd restart

    but I have found stopping and then starting works better, don't
    ask me why, just have.

    It should now work. Type typing secondsite.com and www.secondsite.com in the browser. If it is not working, then you may have done something wrong.

    If you want to add another domain name here, just append to this file by opening it up and adding more settings to the end, like,

    <VirtualHost 123.123.123.123>
    ServerName www.secondsite.com
    ServerAdmin admin
    DocumentRoot /home/sites/site52/web/other
    ServerAlias secondsite.com
    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^123.123.123.123(:80)?$
    RewriteCond %{HTTP_HOST} !^www.secondsite.com (:80)?$
    RewriteRule ^/(.*) http://www.secondsite.com/$1 [L,R]
    RewriteOptions inherit
    AddHandler cgi-wrapper .cgi
    AddHandler cgi-wrapper .pl
    AddHandler server-parsed .shtml
    AddType text/html .shtml
    </VirtualHost>
    <VirtualHost 123.123.123.123>
    ServerName www.thirdsite.com
    ServerAdmin admin
    DocumentRoot /home/sites/site52/web/directory
    ServerAlias thirdsite.com
    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^123.123.123.123(:80)?$
    RewriteCond %{HTTP_HOST} !^www.thirdsite.com(:80)?$
    RewriteRule ^/(.*) http://www.thirdsite.com/$1 [L,R]
    RewriteOptions inherit
    AddHandler cgi-wrapper .cgi
    AddHandler cgi-wrapper .pl
    AddHandler server-parsed .shtml
    AddType text/html .shtml
    </VirtualHost>


    NOW THE EMAIL PART!!!!!!!!

    First make sure you are at the root of your drive by typing:
    cd /

    then backup the files that you will be editing by typing:
    cp /etc/sendmail.cw /etc/sendmail.cw.backup

    and:
    cp /etc/virtusertable /etc/virtusertable.backup


    Then edit the files as required by typing:
    pico -w /etc/mail/some user list file ?

    Go to the very end of the file and type:

    secondsite.com
    www.secondsite.com

    Then Ctrl-X to exit from pico and save the file

    now type:
    pico -w /etc/virtusertable

    Go to the end of the file beneath the line that reads "# Put custom
    additions below" and type:

    @secondsite.com [email protected]
    @www.secondsite.com [email protected]

    {CBT NOTE: [email protected]}

    (them are not spaces, us your TAB key between .com and %1)
    Then Ctrl-X to exit from pico and save the file

    This sets it up so you can share two domains with one user account [email protected] can get email at [email protected]

    Then at the command prompt type:
    /usr/bin/makemap hash /etc/mail/virtusertable < /etc/mail/virtusertable

    then type:
    /etc/rc.d/init.d/sendmail restart

    This will restart the email server.

    Now you should be set up so that [email protected] will get email
    for [email protected]

    Hope this helps.


    __________________
    L. James Prevo


    Copied from original post from LJP per above! I seem to recall I didn't make 'CBT NOTES' on the mail file locations, but they're listed for a RaQ3, a RaQ4 is slightly different but easily determined.

    Brandon

  7. #7
    I really like to know how to do the same thing on a RaQ550. I have a costumer with 4 domains, and he wants the 3 of them to point on directories under the last domain.

    And one more thing. I'm using a RaQ550 as my primary dns server and a RaQ4 as the secondary.

    Is there any simple way to bacup the dns records from RaQ550 to the RaQ4 or do i have to login into the Raq4 and ad "secondary name service for domain"?

    I can see there is a function called "secondary name service for network". I cant really figure out if this is the function i request.

    sinumsen

Posting Permissions

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