[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] Qube3 serving more than one domain?



On Tuesday, March 12, 2002 10:52 pm, Benedict <jbt@xxxxxxxx> wrote:
>How can I best use the Apache server when I have (for example)
>three different complete websites for three different
>domain-names?
>
>I can point a domain.org to my IP, and understand that
>home/web/ contains this site for the root of this IP-address,
>but how do I get to use other domain names as if they also
>have their own root directory etc. ?
>I know every user can have his/her own site, but how do I use
>other domains on the same Qube3 when zones and DNS
>are served elsewhere?
>
>Should I change httpd.conf for virtual domains
>and if so, what paths/directories on the Qube do I use?
>
>Tnx for your insight on this
>-- 
>Ben

Hi Ben,

This is how you do it for your domains.

edit /etc/httpd/conf/httpd.conf
find the section which has Virtual hosts - this will be commented out.
Add the following lines replacing the relevent data with your own.

begin add from here

NameVirtualHost 192.168.1.210
<VirtualHost 192.168.1.210>
ServerName blue.myprimarydomain.com
ServerAdmin admin
DocumentRoot /home/groups/home/web
RewriteEngine on
RewriteCond %{HTTP_HOST}                !^192.68.1.210(:80)?$
RewriteCond %{HTTP_HOST}                !^blue.myprimarydomain.com(:80)?$
RewriteRule ^/(.*)                      http://blue.myprimarydomain.com/$1 [L,R]
RewriteOptions inherit
AliasMatch ^/~([^/]+)(/(.*))? /home/groups/home/users/$1/web/$3
AliasMatch ^/users/([^/]+)(/(.*))? /home/groups/home/users/$1/web/$3
</VirtualHost>


<VirtualHost 192.168.1.210>
ServerName www.mydomain.com
ServerAdmin admin
DocumentRoot /home/groups/home/myotherdomain
ServerAlias mydomain.com
RewriteEngine on
RewriteCond %{HTTP_HOST}                !^192.168.1.210(:80)?$
RewriteCond %{HTTP_HOST}                !^www.myotherdomain.com(:80)?$
RewriteRule ^/(.*)                      http://www.myotherdomain.com/$1 [L,R]
RewriteOptions inherit
AddHandler cgi-wrapper .cgi
AddHandler cgi-wrapper .pl
AddHandler server-parsed .shtml
AddType    text/html     .shtml
</VirtualHost>

end add here

I suggest that you check out the docs and howto's for apache re virtual sites, you'll find them in the usual places, but this will get you up and running with your primary domain showing in a browser when http://192.168.1.210 is typed in as the address and your primary domain showing up as normal and the other domain showing when a user enters http://www.otherdomain.com into the browser.

The User web pages will also work for the primary domain.

One other thing, you will need to ensure that the dns is set up correctly with A records for the other domain on the DNS servers pointing to the ip address of the qube.

I hope that this helps

Simon