Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Running two homepages on one Apache server



This is called "virtual hosting", and it's a very routine thing to do
with apache. Requests for a site by name get routed to the proper
directory on the server. Mac OS X Server does this through the admin
interface.

It's very easy. In Server Admin (Server Settings on 10.2.x Server), go
to the Web Settings, and then to Sites. When you make a new "Site", you
tell it what the DNS name of the site is, and which directory is its
document root on the server. That's it. So let's say you have
www.foo.org and www.bar.com, two completely different websites. You'd
make one entry for www.foo.org, and tell it that its document root is
whatever you wish, e.g., /Library/WebServer/FooSite. And you'd make one
for www.bar.com, with a document root of, say,
/Library/WebServer/BarSite. (The directories can be anywhere; they
don't have to be in /Library/WebServer. I usually keep mine, there,
though, and I usually name the root the same as the primary url of the
site. So if I have a site like testing.org, I'll make its document root
/Library/WebServer/testing.org.) You'll also probably want to have
different access and error logfiles for each site. It's one of the
settings you can specify for each site; I usually make them something
like /var/log/access_log_testing.org to keep them straight.

That's it; that's how OS X Server does virtual hosting. You just have
as many DNS names as you want/need pointed at the IP address of OS X
Server, and tell OS X Server's web settings what to do when it gets a
request for that particular name. There is a lot more that can be done,
but that's basically it.

One more thing that is commonly done, but doesn't have functionality
exposed in the GUI, is wanting aliases for virtual hosts, i.e., if you
wanted both "foo.org" and "www.foo.org" to both work for the site. One
solution would be to make two identical virtual hosts with the
exception of the DNS name, but that's dirty. The way to do it is to add
a ServerAlias line to the virtual host entry that ends up getting
created by OS X Server. On 10.2.x it's in
/etc/httpd/httpd_macosxserver.conf, and on 10.3.x they're in individual
virtual host files in /etc/httpd/sites. Anyway, you'll see something
like:

<VirtualHost 12.34.56.78:80>
ServerName www.foo.org
ServerAdmin email@hidden
DocumentRoot "/Library/WebServer/FooSite"
...

After ServerName, you can add:

ServerAlias foo.org web.foo.org

...or however many aliases you'd like. They all get processed just as
the main server name does. So in this case, any request for
www.foo.org, foo.org, or web.foo.org would all show whatever website is
in /Library/WebServer/FooSite.

Hope this helps.

- Dave

On Apr 15, 2004, at 4:10 PM, David J. Heyse wrote:

Hi,
I have a Xserver running Apache. Is there a way to run two different
homepages from one sever. My current server homepage is located at
/Library/WebServer/Documents/index.html
ie:
www.homepage1.edu
www.homepage2.edu

Thanks,
David
_______________________

David J. Heyse
Natural Sciences Learning Center
Department of Biology
Washington University in St. Louis
314-935-4627
_______________________________________________
maclabmanager mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/maclabmanager
Do not post admin requests to the list. They will be ignored.
_______________________________________________
maclabmanager mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/maclabmanager
Do not post admin requests to the list. They will be ignored.


References: 
 >Running two homepages on one Apache server (From: "David J. Heyse" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.