Hosting two sites from one domain?

Discussion in 'Server Operation' started by badgerbox76, Apr 10, 2008.

  1. badgerbox76

    badgerbox76 Member

    So I have one site hosted and I want another hosted on the same domain.

    So how can I set this up

    My Main Site
    www.mysite.com
    /var/www/maindir

    My Development Site
    dev.mysite.com
    /var/www/dev


    :rolleyes:
     
  2. rainydayz

    rainydayz New Member

    The configuration varies slightly from distro to distro and depending upon the version of apache you're running. You want to check the documentation for virtualhosts.
     
  3. zcworld

    zcworld New Member

    this is what i use for my vhost site
    just copy and paste and update the info for your needs
    and make sure you got the htdocs / log folder made as well


    step1
    open your ur httpd.conf file
    and add to the bottom of it
    NameVirtualHost *
    include /var/www/conf.d/*.conf

    save it

    mkdir -p /var/www/conf.d
    cd /var/www/conf.d/

    vi www.mysite.com.conf


    <VirtualHost *>
    ServerName www.mysite.com
    DocumentRoot /var/www/vhosts/www.mysite.com/htdocs
    <Directory />
    Options FollowSymLinks
    AllowOverride None
    </Directory>
    <Directory /var/www/vhosts/www.mysite.com/htdocs/>
    Options Indexes FollowSymLinks MultiViews
    </Directory>

    CustomLog /var/www/vhosts/www.mysite.com/logs/access.log combined
    ErrorLog /var/www/vhosts/www.mysite.com/logs/error.log
    </VirtualHost>

    save the file

    mkdir -p /var/www/vhosts/www.mysite.com/htdocs
    mkdir -p /var/www/vhosts/www.mysite.com/log

    repeart as many time as you need (update the info on the fly as you need )
    than restart apache

    make sure you set in your hosts file
    IP <TAB> www.mysite.com

    if you dont have your own DNS server
     

Share This Page