SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2006
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need help configuring subdomains/virtualhost

    I have been trying this for so long, but can't seem to get it to work at all. Have been googling about it and most of the answers are same, but when I apply that, it doesn't work. I must be doing something wrong. I hope you can help.

    I have apache installed on my home computer running windows xp. Everything is working fine. I've signed up in www.dyndns.org and used one of their host name to point to my server. So, let's say parvez.dyndns.org is pointing to my server. So far so good.

    Now, I'm trying to configure subdomain through httpd.conf file so that I can use different folders in my document root as different site. For example: site1.parvez.dyndns.org , site2.parvez.dyndns.org , etc... I tried so many different variations, but I think this is what I tried last in my httpd.conf file:

    Code:
    #
    # Use name-based virtual hosting.
    #
    NameVirtualHost *:80
    
    #
    # VirtualHost example:
    # Almost any Apache directive may go into a VirtualHost container.
    # The first VirtualHost section is used for requests without a known
    # server name.
    #
    <VirtualHost *:80>
    #    ServerAdmin webmaster@dummy-host.example.com
        ServerName site1.parvez.dyndns.org
        DocumentRoot E:/webroot/site1
    #    ErrorLog logs/dummy-host.example.com-error_log
    #    CustomLog logs/dummy-host.example.com-access_log common
    </VirtualHost>
    I'm not that expert on server configuration, so if you could help, that would really helpful. Thanks
    With Regards
    Pman
    http://www.pmansLab.com

  2. #2
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,680
    Mentioned
    20 Post(s)
    Tagged
    3 Thread(s)
    parvez,

    I believe that the problem is that you attempting to point at a named VirtualHost that does not exist. I don't know anything about dyndns.org but I suspect that they've merely setup the DNS for parvez.dyndns.org which has NOTHING to do with site1.parvez.dyndns.org, site2.parvez.dyndns.org, etc.

    IMHO, create these domains locally then, when you're ready, use dyndns.org to point to each of them (using your IP Address and each named domain). To do that, you'll need to modify your local hosts file with the line
    Code:
    127.0.0.1 site1.parvez.dyndns.org
    ... where your Internet IP Address should be used rather than 127.0.0.1 (which is localhost).

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2006
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by dklynn View Post
    I believe that the problem is that you attempting to point at a named VirtualHost that does not exist. I don't know anything about dyndns.org but I suspect that they've merely setup the DNS for parvez.dyndns.org which has NOTHING to do with site1.parvez.dyndns.org, site2.parvez.dyndns.org, etc.
    Hi DK,
    First of all, thanks so much. I hope I can get it to work this time. I was also thinking something along that same line, but didn't know what to do about it.

    Quote Originally Posted by dklynn View Post
    IMHO, create these domains locally then, when you're ready, use dyndns.org to point to each of them (using your IP Address and each named domain). To do that, you'll need to modify your local hosts file with the line
    Code:
    127.0.0.1 site1.parvez.dyndns.org
    ... where your Internet IP Address should be used rather than 127.0.0.1 (which is localhost).
    I think I'll try to get it to work locally first and then worry about the rest. Would you be able to tell me how I would do the above? I'm just not sure how to create the domains locally or what I would modify in the local hosts file(is this the httpd.conf file?)

    Appreciate your help. Thanks
    With Regards
    Pman
    http://www.pmansLab.com

  4. #4
    SitePoint Enthusiast
    Join Date
    Aug 2006
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm just not sure how to create the domains locally or what I would modify in the local hosts file(is this the httpd.conf file?)
    Actually I got that part working. After some googling, I found out that host files are different and what they are used for. In my point of view this is the file that defines 127.0.0.1 as localhost and that's why, both 127.0.0.1 and localhost works when trying to access your local server. I might be wrong, so let me know.

    In case anyone else need help with the same thing, In Windows XP, your host file would be located in
    C:\WINDOWS\system32\drivers\etc
    The file name is "host" and it doesn't have any extention

    Anyways, I added that line that DK suggested, I now have
    Code:
    myIdAddress	site1.parvez.dyndns.org
    So, when I enter site1.parvez.dyndns.org in my browser, I get the root directory that I would get if I try to access localhost. Now, I assume that I will have to configure Apache to point site1.parvez.dyndns.org to point to one of the sub directory in the root directory. Would you be able to tell me how I could do this?

    Thanks so much again for your help. I got a lot further than all this time I was trying to solve it.
    With Regards
    Pman
    http://www.pmansLab.com

  5. #5
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,680
    Mentioned
    20 Post(s)
    Tagged
    3 Thread(s)
    parvez,

    Smart to get it working locally before going off-localhost!

    VirtualHost (in httpd.conf):

    It's very basic. All that's needed is something like:
    Code:
    <VirtualHost *:80>
    ServerName site1.parvez
    DocumentRoot C:/site1
    ServerPath C:/site1
    </VirtualHost>
    Of course, I've removed the dyndns.org from the ServerName AND guessed at C:/site1 as the location of your files. Use your actual location but be sure to use / rather than \.

    hosts (C:\Windows\system32\drivers\etc\hosts - it's an extensionless text file):
    Code:
    127.0.0.1 site1.parvez
    When you get back to using dyndns (and after registering site1.parvez with them), you'll have to add them back to get[code]
    Code:
    <VirtualHost *:80>
    ServerName site1.parvez.dyndns.org
    DocumentRoot C:/site1
    ServerPath C:/site1
    </VirtualHost>
    and

    hosts (C:\Windows\system32\drivers\etc\hosts - it's an extensionless text file):
    Code:
    123.123.123.123 site1.parvez
    Okay, I'm SURE your IP Address is NOT 123.123.123.123 but you'll have to determine that and put it in your hosts file, NOT "myIdAddress" (although I'm sure you were just hiding that, as you should in a public forum, I added that for others' benefit).

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  6. #6
    SitePoint Enthusiast
    Join Date
    Aug 2006
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi David,

    Again, Thanks so much for your help. I did try that virtualhost in httpd.conf file but something is not working properly. I haven't had a chance to troubleshoot it yet. But, when I try it again, or have time to troubleshoot it(may be next month) I will definitely post it here. I'm sure I'm doing something wrong. Thanks again.
    With Regards
    Pman
    http://www.pmansLab.com

  7. #7
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,680
    Mentioned
    20 Post(s)
    Tagged
    3 Thread(s)
    parvez,

    You're very welcome. Good Luck!

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  8. #8
    SitePoint Guru rockit's Avatar
    Join Date
    Sep 2005
    Location
    Canada
    Posts
    636
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by parvez View Post
    Hi David,

    Again, Thanks so much for your help. I did try that virtualhost in httpd.conf file but something is not working properly. I haven't had a chance to troubleshoot it yet. But, when I try it again, or have time to troubleshoot it(may be next month) I will definitely post it here. I'm sure I'm doing something wrong. Thanks again.
    Parvez, just so you know, you can have site1.example.dyndns.org.

    In the services area, you just need to have a checkbox enabled for
    Yes, alias "*.hostname.domain" to same settings.

    Using that, you can have site1. ... site2. ... site3. ...

    Give it a shot.

  9. #9
    SitePoint Enthusiast
    Join Date
    Aug 2006
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey Rockit,

    Thanks for the reply. Unfortunately I didn't have a chance to go back to this before. Recently I needed to format my computer. so, I'm trying to get the latest php 5.2.5 and apache 2.2.8 working together. Having hard time getting php to work. I have another thread regarding that. Once I have this out of the way, I'll try this virtual host thing again.
    With Regards
    Pman
    http://www.pmansLab.com


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
  •