Apache Virtual Hosts

Discussion in 'Server Operation' started by micko_escalade, Mar 11, 2008.

  1. micko_escalade

    micko_escalade New Member

    Howdy all,

    1. Can someone please post virtual host configuration for total of 4 domains? in httpd.conf

    2. where directories for virtual domains should be ?
    /var/www/html/domain1.com
    /var/www/html/domain2.com
    etc.
    ?

    Thanks!
     
  2. Musty

    Musty New Member


    <VirtualHost *:80>
    DocumentRoot /var/www/html/site1_folder
    ServerName domain1.com
    <Directory "/var/www/html/site1_folder">
    </Directory>
    </VirtualHost>


    <VirtualHost *:80>
    DocumentRoot /var/www/html/site2_folder
    ServerName domain2.com
    <Directory "/var/www/html/site2_folder">
    </Directory>
    </VirtualHost>

    Just copy and paste the directive above and change the folder and domain name accordingly for more domains.

    Hope this helps
     
    Last edited: Mar 11, 2008
  3. zcworld

    zcworld New Member

    what linux OS your using
    if its an redhat /centos / fedora and i think there is an opensuse 10 ver as well

    MkVhost
    redhat ver : download


    check this out its an simple tool that a friend made for me age ago
    when i was starting out with vhost

    had a s**t load of problems when i started out with setting them up right and so on


    ok

    i would do it like this

    /var/www/vhost/<site>
    /htdocs
    /tmp
    /logs
    /cgi-bin (if needed)
     
  4. Musty

    Musty New Member

    Hey czworld, How about using what I suggested?
    It works fine for me. But I did download the mkvhost thing. Great tool. But, confused as I am, I'd rather stick to the easiest way, huh?

    check it out here:

    http://www.elkadimi.org

    Cheers :)
     
  5. zcworld

    zcworld New Member

    hint hint

    you would never put your VHOST sites into the /var/www/html or /var/www/htdocs folder
    because thats the apache DEFAULT home folder
     
  6. micko_escalade

    micko_escalade New Member

    Thanks guys!
     
  7. Musty

    Musty New Member

    So what if it's the DEFAULT folder. You mean it is not safe? That somebody might guess where the web site is located? What difference does it make if it's in /var/www/html/ or in, say, /var/www/somefolder ?

    Excuse my ignorance!
    :eek:
     
  8. zcworld

    zcworld New Member

    if you got like an privte admin backend site
    with like
    mydns
    phpmyadmin
    and any other tools you use
    last thing you want is anyone to find it and see if
    than have access to it

    and its makes it easy to do an quick backup if all of your VHOST sites are in one folder
    say if you have 3 or 4 or more
     
    Last edited: Mar 12, 2008

Share This Page