<NameVirtualHost>

Discussion in 'Apache' started by roisen.dubh, May 22, 2007.

  1. #1
    I *kind of* understand how to host multiple websites on the same server, but I still have a few questions that maybe you guys can help me sort out.

    I know that I put

    NameVirtualHost *

    <VirtualHost *>
    ServerName www.domain.tld
    ........

    into a config file, but which file, and where at in that file?

    Also, for the document root, must I specify the file relative to the apache folder, or can I specify C:/...../index.html ?

    I think that's all for now. Please help me!
     
    roisen.dubh, May 22, 2007 IP
  2. Davidj

    Davidj Peon

    Messages:
    124
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Well, the config. file in a *nix environment is httpd.conf for apache.
    It might be a tad different for windows based systems. I wouldn't know.

    The path will not be relative. It will need to be the full path.
     
    Davidj, May 22, 2007 IP
  3. roisen.dubh

    roisen.dubh Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    So may I append the virtual host information to the end of that file? I also notice that at the end of this file it references a virtual host config file. Should the information go in there?
     
    roisen.dubh, May 24, 2007 IP
  4. aras

    aras Active Member

    Messages:
    533
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    60
    #4
    It is prexif/conf directory. Most unix and control panels install it on /usr/local/apache/conf/httpd.conf. You can paste your vhost on the very down side of the conf file. Restart the server after modifying the config.
     
    aras, May 24, 2007 IP
  5. roisen.dubh

    roisen.dubh Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thank you for your help. I will return here with any additional questions
     
    roisen.dubh, May 24, 2007 IP
  6. roisen.dubh

    roisen.dubh Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I have tried again and again, following the advice already given, but I am still running into problems.

    When I paste

     NameVirtualHost *
    
    <VirtualHost *>
    ServerName johnsporch.serveftp.net
    ServerAlias johnsporch.*
    DocumentRoot "C:\Program Files\xampp\htdocs\"
    </VirtualHost>
    
    <VirtualHost *>
    ServerName 192.168.0.5
    DocumentRoot "C:\Program Files\xampp\htdocs\reflection\"
    </VirtualHost>
    Code (markup):
    into the bottom of my httpd.conf file and restart the service, when I type in 192.168.0.5, I am taken to the other directory, and when I have a friend go to johnsporch.serveftp.net, he is taken to the same place. However, clicking on any link results in a server busy error.

    Help?
     
    roisen.dubh, May 26, 2007 IP
  7. scaturan

    scaturan Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    does johnsporch.serveftp.net resolve to the IP address (with or without port forwarding) Apache is listening off?

    ServerAlias johnsporch.* <- wrong syntax - use subdomain.domain.tld or *.domain.tld (wildcard always prepend the .domain.tld)

    Using * is a lazy way to learn virtual hosting with Apache. :)

    once more, read through httpd.apache.org/docs/2.2/vhosts/
     
    scaturan, Jun 2, 2007 IP