PDA

View Full Version : Hosting two sites from one domain?


badgerbox76
10th April 2008, 02:01
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:

rainydayz
10th April 2008, 12:09
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 (http://httpd.apache.org/docs/2.0/vhosts/).

zcworld
10th April 2008, 13:16
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