Lee, I’ve done this for multiple sites (domains) accessing a 4D instance. I’ve done it through several OS versions; currently my server’s running El Capitan (10.11.8)
Here’s a step by step guide for a domain I’ll call “mydomain.com <http://mydomain.com/>”. 1) Set up the sites with the server app, and in the “Store Web Files In” field have them reference the webdata folder where all of your 4D web content is stored (rather than the default folder that the server app would try to reference). 2) After creating a site (or multiple sites), go to Library -> Server -> Web -> Config -> apache2 -> sites and look for the configuration (.conf) file ending with the name of the domain name you created. (I do this in TextWrangler, entering an admin password as prompted to save my changes). So in this example, I’m looking for the file name ending in mydomain.com.conf At this point you have a bit of flexibility … you can put some of your code in an external file and “include” it in the .conf file, or you can put everything directly into the .conf file… but either way you basically want to set up some ProxyPass directives. I do these in an external file (actually, two files), then reference those in the conf file for the site instance. I’ll first show you the two external text files I create, then show you how to edit the conf file for the virtual domain (mydomain.com.conf) to reference those files. 3) Create a separate text file, in the same Sites folder, called mydomainincludes.config In the text file write the following lines: ProxyPass / http://mydomain.com:8080/ ProxyPassReverse / http://mydomain.com:8080/ Note that this example assumes that 4D is configured to serve web content on port 8080. Adjust the web settings or config file as necessary to reference the correct port, and of course use the actual domain name. I create one of these .config files for each domain name that I’m proxying; very simple, two lines of code. 4) Optionally, you can also create a config file that will be shared by all of your sites that are being proxied, with some settings they’ll all share. I do that to tell Apache to ignore proxy settings for static content, allowing the Apache server to send out things like jpegs without bothering (proxying to) 4D’s web server. So I have a second text file in the sites directory called allsites.config, and it contains instructions to NOT proxy several directories. (The name of the config file doesn’t matter; you’ll be referencing it by name later.) Vary the list of directories below according to the content of your site; include any directories where accessing the content directly via Apache, rather than going through 4D, will not affect the outcome. You wouldn’t want to include a directory of dynamic pages here, unless your design sends out all dynamic pages using Web Send File. What you want to avoid including on the bypass list are dynamic .shtml pages that are directly called by a URL (http://mydomain.com/mypages/mypage.shtml) and contain code in them that executes 4D methods; those are pages you want served by 4D. ProxyPass /media/ ! ProxyPass /js/ ! Proxypass /logos/ ! Note that if you have any directories that can be bypassed but that are specific to one domain, you can include those at the top of your domain-specific config file rather than in this shared file used by all domains. (These “except for these directories” commands need to be read by Apache before the ProxyPass commands to route things over to 4D on port 8080.) So, if I have a directory called mydomainStaticStuff, which contains only static content relevant to that one domain, I could include the following directive before the first ProxyPass line in mydomain.config, described in step 3 above, instead of putting it in a separate shared file. ProxyPass /mydomainStaticStuff/ ! Indeed, if you wish you can handle all of the static content that way, including the bypass directives in the same file as the ProxyPass directives; I just use the shared file because I have about a dozen directories of static content that are shared by several sites. 5) Now we include the above config files in the mydomain.conf file. Open that file in your text editor, go to the line right after ErrorLog /var/log/apache2/error_log and add the following lines. (When you start typing, you’ll be asked if it’s okay to unlock the file. Say yes). ProxyPreserveHost on Include "/Library/Server/Web/Config/apache2/sites/allsites.config" Include "/Library/Server/Web/Config/apache2/sites/mydomainincludes.config” Of course, if you chose not to create a separate config file with directives shared by several sites, you can skip that “Include” line. If you would rather put all of the code into the conf file, instead of creating some external config files, then your edit would look more like this: ProxyPreserveHost on ProxyPass /mydomainStaticStuff/ ! ProxyPass /media/ ! ProxyPass /js/ ! Proxypass /logos/ ! ProxyPass / http://mydomain.com:8080/ ProxyPassReverse / http://mydomain.com:8080/ Then save the .conf file. You’ll be asked for an administrator password. If you’re doing several of these in sequence, you won’t be asked for the administrator password for each file, only after some time interval has passed. 6) Repeat the above for any other domains, substituting the appropriate file for mydomainincludes.config. If you have a separate .conf for a site that’s secured by Apache with an SSL certificate (a port 443 site as opposed to a port 80 site) give it the same changes as the .conf file for the port 80 site. 7) Note that Apache will automatically create backup files ending in .conf.prev and .conf.orig in your sites directory. You want to edit the current file, ending in .conf 8) Restart your web server so it loads the modified conf and config files. You can do this via terminal commands, or just turn the little “websites” switch to Off in the Server app, wait a few seconds until it says offline, and turn it back On. If all is done properly, you’ll be proxying everything through Apache to 4D and back, except for the directories you excluded in allsites.config. You’ll also be handling all of your SSL via Apache, rather than 4D, so make sure Apache has your SSL certificates. When you’re done, I recommend making a backup of the entire sites folder (the one with all of those conf and config files). OS-X Server has an unfortunate habit of wiping out your changes whenever you do a software upgrade of the server software (every few months). You can recreate these from the .prev versions of the conf files (which will still have your changes) but unless there are other important changes in the .conf file as a result of the server upgrade it can be faster to just drag them back in from your backup. Again, you’ll need to authenticate as an administrator when making changes to the sites directory. HTH! Ron Rosell __ Ron Rosell President StreamLMS 301-3537 Oak Street Vancouver, BC V6H 2M1 Canada Direct phone (all numbers reach me) Vancouver: (+1) (604) 628-1933 | Seattle: (+1) (425) 956-3570 | Palm Beach: (+1) (561) 351-6210 email: [email protected] <mailto:[email protected]> | fax: (+1) (815) 301-9058 | Skype: ronrosell > On Jun 9, 2017, at 11:14 AM, Lee Hinde via 4D_Tech <[email protected] > <mailto:[email protected]>> wrote: > > I've setup apache as a front end to 4D on 'regular' macs without issue. But > now I need to do it on a Mac running the Server software and I'm not clear > where/how to configure that and my google fu is failing me. > > Has anyone done that and can you point to directions? > > I'd settle for having 4D serve directly, but OS X Server is running apache > even with Websites off. > ********************************************************************** > 4D Internet Users Group (4D iNUG) > FAQ: http://lists.4d.com/faqnug.html <http://lists.4d.com/faqnug.html> > Archive: http://lists.4d.com/archives.html > <http://lists.4d.com/archives.html> > Options: http://lists.4d.com/mailman/options/4d_tech > <http://lists.4d.com/mailman/options/4d_tech> > Unsub: mailto:[email protected] > <mailto:[email protected]> > ********************************************************************** ********************************************************************** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:[email protected] **********************************************************************

