Skip navigation

Multiple websites

20410 Views 66 Replies Latest reply: Nov 15, 2011 12:54 PM by hphoeksma RSS
  • Charles Conway Level 1 Level 1 (50 points)
    Currently Being Moderated
    Jul 25, 2011 8:46 AM (in response to Jupeman)

    UPDATE:  I found a work-around that has allowed me to get back 2 of my 3 virtual hosts.

     

    Background:  The "NameVirtualHost" fix alone was not working for me.  I upgraded from Snow Leopard Server and no place I put NameVirtualHost would enable my <VirtualHost my.hostname.com:80>  to work.

     

    I read an apache.org website about VirtualHosts and DNS errors that says that a VirtualHost definition may be ignored if Apache cannot resolve the VirtualHost/ServerName to an IP address.  My testing seems to indicate that my VirtualHost directives are just being skipped, so I tried putting in my static IP for the <VirtualHost> and then using the ServerName to specify the hostname for the virtual host.  In addition, I added the 00000_MoreTestingRequired.conf file and added a NameVirtualHost line for each hostname.

     

    Now several of my subdomains are working again!  The only remaining issue is that I cannot specify separate virtual hosts for mainhostname.domain.com, domain.com, or www.domain.com.

     

    So, maybe this is all a DNS issue?

  • trandos Calculating status...
    Currently Being Moderated
    Jul 25, 2011 7:01 PM (in response to Charles Conway)

    Just forget it and reinstall SLS. I have reinstalled SLS and am happy now. Everything works without pain.

  • Spinland Level 1 Level 1 (50 points)
    Currently Being Moderated
    Aug 1, 2011 4:55 AM (in response to SGlazier)

    I created the file as descriped in the post marked as a solution, and restarted the Web service using the Server App.

     

    Then I tried to create a new web site, as follows:

     

    Screen shot 2011-08-01 at 7.47.32 AM.png

    When I click "View Document Root Contents" I see the correct folder that has a complete web site's files stored there.

     

    Then I go back to the main Web Server screen, select the new site, and click "View Server Web Site."  I still get sent to the default site location as listed in the original web site listing (which I can not edit or delete).

     

    Screen shot 2011-08-01 at 7.53.17 AM.png

     

    What else am I supposed to do in order to get custom web sites working on this thing? Ideally I would just like to be able to edit "node01.local" to point it to the files where I want them to be stored, but I don't uderstand why it won't let me edit it, and it seems I cannot even override it with my own settings.

     

    Help?


    Thanks in advance.

  • sbkeith Level 1 Level 1 (50 points)
    Currently Being Moderated
    Aug 1, 2011 8:54 AM (in response to Spinland)

    The View Server Website will never change.  It is the default wiki site (and all other related services) set up by LS.  You can tell apache where to search for your custom web site files by clicking the Store site files in: drop down and then navigate to your folder.  Check to make sure they have been added to your site definition file by taking a peek at /etc/apache2/sites/0000 (your new site name here)80.conf.

     

    There should be an entry in that file that points to your site files directory.

     

    In your httpd.conf file place


    NameVirtualHost *:80

    NameVirtualHost *:443

     

    in a common area.

     

    Also, as a side note:

     

    In your site definition files, adding the:

     

    ServerAlias www.example.com (or whatever the name)

     

    will help with the alias www because the server will only serve out http://test.local no matter how many CNAMEs you have in DNS for that site.

     

    LS appears to have only been aimed at a one site, small services, basic configuration installation. If  you want all the advanced services that were available in the GUI of SLS, you're going to either have to stay with SLS, or go to Apache's web site and do some detailed reading unfortunately.

     

    I can't jynx myself, but after endless endless endless hours of installing, reinstalling, editing, resinstalling and much reading - I finally got LS to work for the most part.  If it weren't for the push email to my employees iPhones/iPads - I would have gone back and stayed with SLS.

     

    HTH

    Scott

  • Spinland Level 1 Level 1 (50 points)
    Currently Being Moderated
    Aug 1, 2011 9:31 AM (in response to sbkeith)

    Thanks. I actually don't want multiple sites, I only tried that because I can't seem to be able to change the default files location for the main one. That's all I want: one web site, but that points to the files where I want to place them.  I don't have a host name dedicated to this site, I'm on a residential ISP with dynamic IP addresses but I have a dyndns entry configured so I can hit the web server from outside just fine.

     

    It's just this pesky default location thing that's hanging me up. I have the Mini Server drives striped into a RAID and I do not want data stored on it, I have external data drives for that and I want the web server to use one of them.

  • Spinland Level 1 Level 1 (50 points)
    Currently Being Moderated
    Aug 1, 2011 9:54 AM (in response to Spinland)

    Okay, the light finally dawned.  When I create the new Web Server entry the dyndns.org URL has to go in the Domain Name block, not some local alias I made up. Duh.

     

    Okay, it's working exactly as I wanted. Thanks for helping jog my slow brain!

  • Brian S. Campbell Level 1 Level 1 (75 points)
    Currently Being Moderated
    Aug 1, 2011 10:48 AM (in response to Spinland)

    @Spinland (and @sbkeith), I've also tried the "solution" to the original post with no luck. I want to continue to host the profile manager etc. But also add one (or more) custom sites. At DynDNS I've set my domain and one subdomain like so...

    dns.gif

    Currently they both just resolve to the default web site. Say I want the server.mydomain.com to resolve to the default site and the base domain to resolve to a different custom site, what do I need to do?

  • Spinland Level 1 Level 1 (50 points)
    Currently Being Moderated
    Aug 1, 2011 6:15 PM (in response to Brian S. Campbell)

    Brian,

     

    You need to ignore the default web server that's listed in the Server App, and create two new entries representing the two subdomains you have. In the URL box for each enter the specific URL for that subdomain, and point the folder's location to the files you want served for that subdomain. You probably need to add that 00000_whatever file that's mentioned upstream in this thread so the different entries are honored. That worked for me, I registered two domains in the free dyndns service and have them pointed to different volumes in my Mini Server.

     

    Hope that helps!

    Mark

  • Brian S. Campbell Level 1 Level 1 (75 points)
    Currently Being Moderated
    Aug 1, 2011 7:01 PM (in response to Spinland)

    Hey Mark,

    Thanks for the reply! So, here's what i've got set up. Given that my registered domain name is example.com...

     

    At DynDNS i have an A record for example.com and a CNAME wildcard record that points to my fully qualified domain at example.com. <= trailing dot included

     

    dyndns.gif

     

    Ignoring the default website, I've created two more sites:

    cameras.example.com points to /Library/Server/Web/Data/Sites/cameras

    test.example.com points to /Library/Server/Web/Data/Sites/CustomSitesDefault

     

    websites.gif

     

    Following the directions above I've also added the 00000_MoreTestingRequired.conf to the /private/etc/apache2/sites directory with the following lines:

    NameVirtualHost *:80

    NameVirtualHost *:443

     

    Just as an FYI, here's how my DNS looks currently...nothing custom here, this setup was automatic per my setup in Server.app

     

    dns.gif

     

    I've also started/stopped the web service in the Server app and run sudo apachectl restart from the command line.

     

    After all this...nothing works. Not even the default site comes up. If I kill the two new sites, the default site suddenly works again...any thoughts?

  • Spinland Level 1 Level 1 (50 points)
    Currently Being Moderated
    Aug 2, 2011 3:54 AM (in response to Brian S. Campbell)

    I'm not sure what your problems might be, but I can point out a couple of things that are different than mine in hopes one of them is a clue.  In the 00000_MoreTestingRequired.conf file I only have:

     

    NameVirtualHost *:80

     

    At dyndns I have two domains registered using the free service, so no wildcards (and I'm not sure what the trailing dot is for).  In my router I have the server's internal IP set static and all port 80 stuff forwarded to that IP.

     

    I don't have Lion Server doing anything with DNS, that service is entirely disabled.  Only dyndns does my lookups and the Lion Server just points each given incoming URL to the appropriate directory.

     

    I'm mostly stumbling through this process by trial and error; I wish I had more clueful insights to offer but that's how I managed to get it working.

     

    HTH!

    MacBook Pro 17, Mac OS X (10.7), Mac Mini Server; Time Capsule
  • Brian S. Campbell Level 1 Level 1 (75 points)
    Currently Being Moderated
    Aug 2, 2011 8:06 AM (in response to Spinland)

    Thanks Mark,

     

    I've tried with just NameVirtualHost *:80 and NameVirtualHost *:443 alone. Neither of those seemed to change anything for me. The trailing dot entered in DynDNS is just to indicate a "Fully Qualified Domain Name" or FQDN.

     

    When I originally set up the server, I chose the "Host name for Internet" option. It seems you may have picked either the "Host name for local network" or "Host name for private network". I suppose that might be causing the difference. However, I'm trying to host Address Book and Calender services for MacOS and iOS devices so I figured it made sense. Like you, i'm fumbling my way through this. I went through a similar process setting of SL server. DNS especially can make your life miserable.

     

    Anyway, I may try to start a new thread. This one seems to be loosing traction and I think my setup might be slightly different than others that have posted here.

     

    Thanks for your time!

  • sbkeith Level 1 Level 1 (50 points)
    Currently Being Moderated
    Aug 2, 2011 9:11 AM (in response to Brian S. Campbell)

    It's not that it's losing traction, just most of us SysAdmins run our own static DNS servers and don't have a lot of experience with DynDNS.

     

    Looking at your DNS config I see a few things that you should change.

     

    Your primary zone should be:

     

    example.com

     

    That's it. Everything after that is just aliases (CNAMES) or extensions of your zone.

     

    You should not have a primary zone of:      server.example.com   Even though this was setup by LS, delete it.

     

    Server is an alias of your zone.

     

    Under the primary zone of example.com add a CNAME of "server."   Also your machine names should all resolve to your primary zone if you're only using one machine, such as an A record for server.example.com pointing to example.com, etc...

     

    Also, in your site setup area, you have two sites setup as test.* and cameras.* of your primary zone.  Neither one of those aliases are even listed in your DNS.  If a site can't be resolved in your DNS, it will never work. A wildcard (although I have never used DynDNS and I may be wrong here) is not used in DNS.

     

    So just like above, make sure you have two CNAME entries in your DNS under your primary zone of example.com for test and cameras (or whatever they are under the red line).

     

    DNS is a beeyatch.

     

    Also, I am assuming  you have a dynamic IP address on your router as this is the reason why you are using DynDNS.  For this to even work, your DynDNS settings should point to your router and then your router needs to use NAT and port forwarding for the external services to find your internal server.

     

    And this is another can of worms all in itself.  I would check with  your service provider and see if they can offer you a static IP address - the extra $ will be worth it in the long run.

     

    Anyone with DynDNS experience that can help Brian out?

  • Tim Bloom1 Level 1 Level 1 (110 points)
    Currently Being Moderated
    Aug 2, 2011 10:16 AM (in response to sbkeith)

    I'm completely bookmarking your DNS post sbkeith. To share with friends who want me to explain DNS to them. It's one of the more difficult concepts to relay to another person. Thanks for the post!

  • Brian S. Campbell Level 1 Level 1 (75 points)
    Currently Being Moderated
    Aug 2, 2011 11:21 AM (in response to sbkeith)

    Thanks @sbkeith, your post is very helpful. My router (AEBS) is NATing, has a fixed internal IP (192.168.0.1), and is port forwarding the necessary services (in my case iCal, Web (HTTP/S), Address Book) to my server's fixed internal IP (192.168.0.2). I would definitely prefer to use a static external IP, but it's prohibitively expensive with my ISP

     

    Based on my understanding of your feedback, here are my settings. At DynDNS i have two CNAME aliases pointed to my primary domain...

     

    aliases.gif

     

    Same in DNS settings

    dns.gif

     

    And I added a website for one of the subdomains in Server.app

    websites.gif

    Unfortunately, I'm still seeing the same problem. If I only have the default web site, it works great. Any added website kills everything. sudo apachectl -t returns Syntax OK and sudo changeip -checkhostname returns success

     

    If anyone else has any suggestions I'd love to hear them!

  • Brian S. Campbell Level 1 Level 1 (75 points)
    Currently Being Moderated
    Aug 2, 2011 2:51 PM (in response to Brian S. Campbell)

    UPDATE: it seems my main problem was my self-signed certificate. I killed it and disabled everything that would require it and now it seems my sites are working (HTTP only of course). I know almost nothing about certificates so I'm sure I set up some parameters incorrectly when I created it. I should have thought to look at that sooner. Apologize for wasting your time! If anyone has any pointers on getting a certificate set up for web/ical/address book services I'd appreciate it...sorry for leading folks down a rabbit hole

Actions

More Like This

  • Retrieving data ...

Bookmarked By (16)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.