Newsroom Update

Beginning in May, a special Today at Apple series titled “Made for Business” will offer small business owners and entrepreneurs free opportunities to learn how Apple products and services can support their growth and success. Learn more >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Multiple websites on one server

I've been trying to create multiple (two) websites on one server, with little luck. One sight works fine. I've tried creating a DNS entry for the new one, but I'm not sure what to set the IP to. I've tried many configurations of IP/hostname but nothing seems to work. Occasionally, the logs just disappear from the logs window.

I've read on here that it's possible to run multiple sites off of one IP, so I feel like that is not the problem. Ideally, I'd like to have one of the sites not exist in the System/WebServer folder. If I place the site folder outside of that folder, do I have to add its folder as a share point and/or modify its permissions?

Server version is 10.6.3

Mac OS X (10.5.6)

Posted on Jun 15, 2010 3:15 PM

Reply
8 replies

Jun 15, 2010 4:15 PM in response to Brewster B

I'm going to distinguish the web browser (client), the web server, and the DNS server here, and will treat these as running on three separate computers. You might have one or more of those co-located on one box, adjust these references to your configuration as necessary.

The DNS translations are applicable only on the client; on the host box that is running with the web browser. The web server doesn't care about the DNS translation. The client needs the DNS to get the IP address of the web server, and it's off to the races from there.

Again, DNS translations are not relevant the web server. The particular web server that gets selected (Apache Virtual Host, what Apple calls a "Site") based on some information that is passed within the http (don't start working with https quite yet) connection from the web browser into the web server.

As for your DNS question, you'll probably want a CNAME (alias) entered in DNS database for the virtual hosts, even if you're awash with IP addresses. That alias must then match the name of the web server "Site". For testing, you can enter what amounts to CNAMES into /etc/hosts on the client, depending on your local set-up and your DNS server.

By default, the connections to all virtual hosts are via port 80. Stay there for now.

The web server selections are sensitive to the order of the "Sites" in the listing in Server Admin, too; you'll want the wildcard site (if you have that) at the end of the list.

Here are some of the basics: [Apache Tips: One Web Server, Multiple Distinct Web Sites|http://labs.hoffmanlabs.com/node/1282]. Comments on that are welcome.

Jun 15, 2010 5:14 PM in response to Brewster B

In addition to what MrHoffman says, make sure that you don't have a wildcard (*) set in the Site Aliases section of your first web site. If you do then Apache will use this site's configuration for all sites, ignoring any other virtual hosts you have running on the same server.

You don't actually say what your failure state is (i.e. site not found? site1 always being served, regardless of hostname?, something else?) so it's hard to tell if that's the problem, but historically that's been the #1 cause of multiple sites not working in Mac OS X Server.

Jun 15, 2010 5:51 PM in response to Camelot

The DNS setup I have on this particular server is fairly simple. I have one DNS entry, and that's for the server itself. When I added the second website, I added a machine record entry, with the name of the Site matching the Machine Name in the record. I tried this with an alias entry as well.

The Sites setup is as advised, with both ports being set to 80. The IP address on both sites is set to the IP of the server. x

I've removed any wildcards.

I have two sites, "A" and "B". With both enabled, my browser (on the server and the client) only goes to the one that is in the top of the Web list. The site that should be shown does not show.

So, in this example, site B is at the top of my sites list. I enter "sitea.mydomain.com", and Site B shows in the browser. Site A's log, however, shows that the web service is accessing files (with GETs) from site A's Web Folder directory, even though the two have totally different paths specified.

With one unchecked, the site shown will always be the one that is unchecked.

Thanks for the tips - I'll take a look at that site you posted, Mr. Hoffman. Your clarification about the DNS only being relevant to route the traffic between the client and the server is helpful.

Jun 15, 2010 5:54 PM in response to Brewster B

It would be typical to have one DNS zone for each domain or subdomain you're working with, and one A record for the server and multiple CNAMEs for the aliases, either in the same zone or (if you're serving up multiple domains) in the appropriate zone for the domain.

Also ensure the web browser client box is set up to use the DNS server.

This also presumes this configuration is entirely within the LAN, and that you're not trying to use the Mac OS X Server box as a firewall.

If you're mucking around with the zone stuff, set the Time To Live (TTL) value to a short interval, while you're messing with it. Otherwise expect to be flushing the DNS cache on the client.

Jun 15, 2010 6:14 PM in response to Brewster B

What should the destination of the CNAME be set to? I've currently got it set to FQDN of the DNS name of the server itself.


You'd have, say, "MyServerAlias" within, say, the "example.com" zone (if you're not running an FQDN here) which would be "MyServerAlias.example.com" translating on the client box to, say, "myrealserver.example.net." (FQDN) for the CNAME, which then gets translated to the IP address, and whatever is in the URL bar sent over the network to the Apache Server via http.

Multiple websites on one server

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.