Changes for page Configuring Apache for WebObjects
Last modified by Aaron Rosenzweig on 2020/09/03 22:17
From version 56.1
edited by Kieran Kelleher
on 2009/04/16 06:37
on 2009/04/16 06:37
Change comment:
There is no comment for this version
To version 57.1
edited by Pascal Robert
on 2012/02/11 08:44
on 2012/02/11 08:44
Change comment:
Migrated to Confluence 4.0
Summary
-
Page properties (3 modified, 0 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,1 +1,1 @@ 1 - Web Applications-Deployment-Apache1 +Configuring Apache for WebObjects - Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. kieran1 +XWiki.probert - Content
-
... ... @@ -1,18 +1,18 @@ 1 1 == Overview == 2 2 3 -In a deployment scenario on Mac OS X, Linux, orSolaris, your applications will most likelybedeployedonApache.Web Applications-Development-Direct Connect]] section for details), you will be running your application locally through Apache as well.3 +In a deployment scenario on Mac OS X, Linux, Solaris or even Windows, your applications will most likely use Apache to server static resources. Additionally, if you develop with WODirectConnectEnabled=false (you **should**, see the [[Direct Connect>>doc:WO.Development-Direct Connect]] section for details), you will be running your application locally through Apache as well. Apache is a very extensible web server that provides a huge number of capabilities, some of which we will detail here. 4 4 5 5 == Split Install == 6 6 7 -WebObjects applications are deployed in a "split install". ##/Library/WebObjects/Applications///YourApp//.woa##), while your##WebServerResources##are installed in another location (on OS X,##/Library/WebServer/Documents/WebObjects///YourApp//.woa/Contents/WebServerResources##) to be served directly by Apache.7 +WebObjects applications are deployed in a "split install". A split install means that your application code, components, and resources are deployed in one location to be served from your WebObjects application (on OS X, {{code language="none"}}/Library/WebObjects/Applications/{{/code}}//YourApp//{{code language="none"}}{{/code}}{{code language="none"}}.woa{{/code}}), while your {{code language="none"}}WebServerResources{{/code}} are installed in another location (on OS X, {{code language="none"}}/Library/WebServer/Documents/WebObjects/{{/code}}//YourApp//{{code language="none"}}{{/code}}{{code language="none"}}.woa/Contents/WebServerResources{{/code}}) to be served directly by Apache. This provides the optimal performance scenario, as Apache is specifically tuned for serving static content, and it does not make sense to send requests for large binary files through WebObjects if it is not necessary. 8 8 9 -== mod //expires//==9 +== mod_expires == 10 10 11 -To get the most performance out of Apache, you should make sure that you have mod //expires enabled.//expires controls the caching headers that are applied to static resource requests.//expires disabled, which would cause your end-users' browser to re-request every resource on your site on every page, even if it's a common header graphic.//11 +To get the most performance out of Apache, you should make sure that you have mod_expires enabled. mod_expires controls the caching headers that are applied to static resource requests. Depending on your installation, Apache may default to mod_expires disabled, which would cause your end-users' browser to re-request every resource on your site on every page, even if it's a common header graphic. 12 12 13 -An example mod //expires configuration might look like~://13 +An example mod_expires configuration might look like: 14 14 15 -{{code value="xml"}}15 +{{code 0="xml"}} 16 16 17 17 <IfModule mod_expires.c> 18 18 ExpiresActive On ... ... @@ -28,7 +28,7 @@ 28 28 29 29 You will also need the corresponding type-extension mappings: 30 30 31 -{{code value="xml"}}31 +{{code 0="xml"}} 32 32 33 33 <IfModule mod_mime.c> 34 34 AddType image/bmp bmp ... ... @@ -44,18 +44,17 @@ 44 44 45 45 This tells Apache that when a request is made for a type image/gif, the requesting browser will be told not to request the image again for an hour (A3600 = 3600 seconds). 46 46 47 -== mod //rewrite//==47 +== mod_rewrite == 48 48 49 -Anyone who has used WebObjects has likely noticed that WebObjects URLs are long ##[[http://yoursite.com/cgi-bin/WebObjects/AppName.woa/wa/something]]##.##[[http://yoursite.com]]##.//rewrite" that allows you to rewrite the URL requests of your site based on a series of regular expressions and rules.//49 +Anyone who has used WebObjects has likely noticed that WebObjects URLs are long [[http:~~/~~/yoursite.com/cgi-bin/WebObjects/AppName.woa/wa/something>>url:http://yoursite.com/cgi-bin/WebObjects/AppName.woa/wa/something||shape="rect"]]{{code language="none"}}{{/code}}. It is a common request to make these URLs nicer for end-users who are used to just requesting [[http:~~/~~/yoursite.com>>url:http://yoursite.com||shape="rect"]]{{code language="none"}}{{/code}}. Fortunately Apache provides an amazingly extensive module called "mod_rewrite" that allows you to rewrite the URL requests of your site based on a series of regular expressions and rules. 50 50 51 -Aaron Rosenzweig has a very thorough article about [[using mod//rewrite with Apache//>>http://web.archive.org/web/20071007074308/http://www.jewelryluv.com/fashion/pageWithName/ModRewrite/]]. 52 -(Note that the original page is now gone, so this link takes you to the internet archive copy of that page) 51 +Aaron Rosenzweig has a very thorough article about [[using mod_rewrite with Apache>>url:http://www.jewelryluv.com/fashion/pageWithName/ModRewrite/||shape="rect"]]. 53 53 54 -=== mod //rewite with mod//webobjects ===53 +=== mod_rewrite with mod_webobjects === 55 55 56 -I ran into a problem with mod //rewrite when using mod//WebObjects where mod//WebObjects had be loaded first or it just wouldn't work properly (it would work fine with cgi-bin adaptor).//55 +I ran into a problem with mod_rewrite when using mod_WebObjects where mod_WebObjects had be loaded first or it just wouldn't work properly (it would work fine with cgi-bin adaptor). 57 57 58 -So in http.conf, search for mod //rewrite and change it to~://57 +So in http.conf, search for mod_rewrite and change it to: 59 59 60 60 {{noformat}} 61 61 ... ... @@ -77,9 +77,9 @@ 77 77 78 78 === Mike Schrag === 79 79 80 -Here's an example mod //rewrite we use on one of our apps~://79 +Here's an example mod_rewrite we use on one of our apps: 81 81 82 -{{code value="xml"}}81 +{{code 0="xml"}} 83 83 84 84 <IfModule mod_rewrite.c> 85 85 RewriteEngine On ... ... @@ -91,25 +91,31 @@ 91 91 92 92 {{/code}} 93 93 94 -The WOA produces URLs in the format ##[[http://site.com/page/HomePage?appNum=2]]##, which turns into##[[http://site.com/cgi-bin/WebObjects/AppName.woa/2/viewPage?pageName=HomePage]]##.93 +The WOA produces URLs in the format [[http:~~/~~/site.com/page/HomePage?appNum=2>>url:http://site.com/page/HomePage?appNum=2||shape="rect"]]{{code language="none"}}{{/code}}, which turns into [[http:~~/~~/site.com/cgi-bin/WebObjects/AppName.woa/2/viewPage?pageName=HomePage>>url:http://site.com/cgi-bin/WebObjects/AppName.woa/2/viewPage?pageName=HomePage||shape="rect"]]{{code language="none"}}{{/code}}. 95 95 96 -{{id value="Apache22Adapter"}}{{/id}} 97 97 96 + 97 +{{id name="Apache22Adapter"/}} 98 + 99 +=== Jeff Schmitz === 100 + 101 +This one stumped me for a couple days, so thought I'd add it. Was trying to add mod_rewrite functionality as described above, and things went well on my dev machine by adding the rewrite rules just to the /etc/apache2/httpd.conf file. However, on the deployment machine I also had to add them to the /etc/apache2/sites/0000_any_.conf file. 102 + 98 98 == WebObjects Adaptor for Apache 2.2 == 99 99 100 100 === Travis Cripps === 101 101 102 -A number of people have expressed interest in using the WebObjects adaptor with Apache 2.2.x. 107 +A number of people have expressed interest in using the WebObjects adaptor with Apache 2.2.x. I finally gotten a chance to sit down and work on it today. I'm writing to let you know that it's available in the Project Wonder CVS repository. (also there are [[precompiled binaries>>url:http://wocommunity.org/documents/tools/mod_WebObjects/||shape="rect"]] for various OS available) 103 103 104 -The necessary changes turned out to be mostly minor updates to change calls to outdated/deprecated functions. //ssl module.//109 +The necessary changes turned out to be mostly minor updates to change calls to outdated/deprecated functions. The biggest (and non-trivial) change was for SSL support. It's been re-written to use Apache's mod_ssl module. 105 105 106 -I've tested with MacOS X 10.4.7, Apache 2.2.2, with and without ssl support. 111 +I've tested with MacOS X 10.4.7, Apache 2.2.2, with and without ssl support. It works in all of my tests. 107 107 108 -Configuration of the web server to work with the adaptor turned out to be surprisingly challenging, due to the new, very strict default access rules that ship in Apache 2.2.x httpd.conf file. 113 +Configuration of the web server to work with the adaptor turned out to be surprisingly challenging, due to the new, very strict default access rules that ship in Apache 2.2.x httpd.conf file. Once I discovered that, it was trivial to change the setting, but it's worth mentioning here to save some people a lot of frustration. 109 109 110 110 The new default configuration is: 111 111 112 -{{code value="xml"}}117 +{{code 0="xml"}} 113 113 114 114 <Directory /> 115 115 Options FollowSymLinks ... ... @@ -120,27 +120,39 @@ 120 120 121 121 {{/code}} 122 122 123 -Your options are to comment out the last 2 lines of that block, or to override them in a VirtualHost block. 128 +Your options are to comment out the last 2 lines of that block, or to override them in a VirtualHost block. Just setting the usual Location block didn't seem to work for me. 124 124 125 125 And, of course, either change the name of the WebObjectsAlias setting from /cgi-bin/WebObjects to <foo>/WebObjects or comment out the ScriptAlias definition for the /cgi-bin/ directory. 126 126 132 +{{info title="Note"}} 133 +The default {{code language="none"}}ScriptAlias{{/code}} directive in the 10.5 and 10.6 {{code language="none"}}httpd.conf{{/code}} files is:\\ 134 + 135 +{{noformat}} 136 + 137 +ScriptAliasMatch ^/cgi-bin/((?!(?i:webobjects)).*$) "/Library/WebServer/CGI-Executables/$1" 138 + 139 +{{/noformat}} 140 + 141 +This prevents {{code language="none"}}/cgi-bin/WebObjects{{/code}} from matching, so no change to {{code language="none"}}WebObjectsAlias{{/code}} or {{code language="none"}}ScriptAlias{{/code}} is necessary. 142 +{{/info}} 143 + 127 127 Other than these tips, it's pretty much the standard compilation and installation, and configuration. 128 128 129 -1. Alter the make.config file in the Adaptors directory of the Wonder repository to reflect your apache installation setup. 146 +1. Alter the make.config file in the Adaptors directory of the Wonder repository to reflect your apache installation setup.* 130 130 1. Run make to build the Adaptor 131 -1. Curse because of that one setting you forgot. 148 +1. Curse because of that one setting you forgot. Fix it. 132 132 1. make clean; make 133 -1. Install the mod //WebObjects module with apxs//150 +1. Install the mod_WebObjects module with apxs 134 134 1. Configure your httpd.conf and either link or copy the WebObjects directory from the standard location (if on MacOS X) to your new htdocs directory. 135 135 1. apachectl configtest; apachectl graceful 136 136 1. Test. 137 -1. Curse again. 138 -1. apachectl graceful. 139 -1. Finally 154 +1. Curse again. Change the httpd.conf file as necessary. 155 +1. apachectl graceful. Go to 8 as necessary. 156 +1. Finally! apachectl graceful 140 140 141 -Enjoy your shiny new WO adaptor. :-)158 +Enjoy your shiny new WO adaptor. 142 142 143 -* Note: if you are getting the error 160 +* Note: if you are getting the error 144 144 145 145 {{noformat}} 146 146 ... ... @@ -151,4 +151,4 @@ 151 151 {{/noformat}} 152 152 153 153 Add to the end of your make.config the following: 154 - ##CC = gcc##171 + {{code language="none"}}CC = gcc{{/code}}