Changes for page Configuring Apache for WebObjects
Last modified by Aaron Rosenzweig on 2020/09/03 22:17
From 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
To 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
Summary
-
Page properties (3 modified, 0 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,1 +1,1 @@ 1 - ConfiguringApachefor WebObjects1 +Web Applications-Deployment-Apache - Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. probert1 +XWiki.kieran - Content
-
... ... @@ -1,18 +1,18 @@ 1 1 == Overview == 2 2 3 -In a deployment scenario on Mac OS X, Linux, Solaris or even Windows, your applications will most likelyuseApachetoserver staticresources. 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.3 +In a deployment scenario on Mac OS X, Linux, or Solaris, your applications will most likely be deployed on Apache. Additionally, if you develop with WODirectConnectEnabled=false (you **should**, see the [[Direct Connect>>Web Applications-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". 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.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, ##/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. 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. 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.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 0="xml"}}15 +{{code value="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 0="xml"}}31 +{{code value="xml"}} 32 32 33 33 <IfModule mod_mime.c> 34 34 AddType image/bmp bmp ... ... @@ -44,17 +44,18 @@ 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>>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.49 +Anyone who has used WebObjects has likely noticed that WebObjects URLs are long ##[[http://yoursite.com/cgi-bin/WebObjects/AppName.woa/wa/something]]##. It is a common request to make these URLs nicer for end-users who are used to just requesting ##[[http://yoursite.com]]##. 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>>url:http://www.jewelryluv.com/fashion/pageWithName/ModRewrite/||shape="rect"]]. 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) 52 52 53 -=== mod _rewrite with mod_webobjects ===54 +=== mod//rewite with mod//webobjects === 54 54 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).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).// 56 56 57 -So in http.conf, search for mod _rewrite and change it to:58 +So in http.conf, search for mod//rewrite and change it to~:// 58 58 59 59 {{noformat}} 60 60 ... ... @@ -76,9 +76,9 @@ 76 76 77 77 === Mike Schrag === 78 78 79 -Here's an example mod _rewrite we use on one of our apps:80 +Here's an example mod//rewrite we use on one of our apps~:// 80 80 81 -{{code 0="xml"}}82 +{{code value="xml"}} 82 82 83 83 <IfModule mod_rewrite.c> 84 84 RewriteEngine On ... ... @@ -90,31 +90,25 @@ 90 90 91 91 {{/code}} 92 92 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}}.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]]##. 94 94 96 +{{id value="Apache22Adapter"}}{{/id}} 95 95 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 - 103 103 == WebObjects Adaptor for Apache 2.2 == 104 104 105 105 === Travis Cripps === 106 106 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)102 +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. 108 108 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.104 +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.// 110 110 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. 106 +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. 112 112 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. 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. 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. 114 114 115 115 The new default configuration is: 116 116 117 -{{code 0="xml"}}112 +{{code value="xml"}} 118 118 119 119 <Directory /> 120 120 Options FollowSymLinks ... ... @@ -125,39 +125,27 @@ 125 125 126 126 {{/code}} 127 127 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. 123 +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. 129 129 130 130 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. 131 131 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 - 144 144 Other than these tips, it's pretty much the standard compilation and installation, and configuration. 145 145 146 -1. Alter the make.config file in the Adaptors directory of the Wonder repository to reflect your apache installation setup. *129 +1. Alter the make.config file in the Adaptors directory of the Wonder repository to reflect your apache installation setup. 147 147 1. Run make to build the Adaptor 148 -1. Curse because of that one setting you forgot. Fix it. 131 +1. Curse because of that one setting you forgot. Fix it. 149 149 1. make clean; make 150 -1. Install the mod _WebObjects module with apxs133 +1. Install the mod//WebObjects module with apxs// 151 151 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. 152 152 1. apachectl configtest; apachectl graceful 153 153 1. Test. 154 -1. Curse again. Change the httpd.conf file as necessary. 155 -1. apachectl graceful. Go to 8 as necessary. 156 -1. Finally !apachectl graceful137 +1. Curse again. Change the httpd.conf file as necessary. 138 +1. apachectl graceful. Go to 8 as necessary. 139 +1. Finally apachectl graceful 157 157 158 -Enjoy your shiny new WO adaptor. 141 +Enjoy your shiny new WO adaptor. :-) 159 159 160 -* Note: if you are getting the error 143 +* Note: if you are getting the error 161 161 162 162 {{noformat}} 163 163 ... ... @@ -168,4 +168,4 @@ 168 168 {{/noformat}} 169 169 170 170 Add to the end of your make.config the following: 171 - {{code language="none"}}CC = gcc{{/code}}154 +##CC = gcc##