Changes for page Configuring Apache for WebObjects
Last modified by Yana Oksner on 2026/01/08 11:38
From version 59.1
edited by Theodore Petrosky
on 2013/07/10 10:20
on 2013/07/10 10:20
Change comment:
There is no comment for this version
To version 58.1
edited by Pascal Robert
on 2012/02/11 08:44
on 2012/02/11 08:44
Change comment:
There is no comment for this version
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. tedpet1 +XWiki.probert - Content
-
... ... @@ -1,18 +1,19 @@ 1 1 == Overview == 2 2 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.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>>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". 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 16 <IfModule mod_expires.c> 17 17 ExpiresActive On 18 18 ExpiresDefault A60 ... ... @@ -27,7 +27,8 @@ 27 27 28 28 You will also need the corresponding type-extension mappings: 29 29 30 -{{code 0="xml"}} 31 +{{code value="xml"}} 32 + 31 31 <IfModule mod_mime.c> 32 32 AddType image/bmp bmp 33 33 AddType image/gif gif ... ... @@ -42,19 +42,20 @@ 42 42 43 43 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). 44 44 45 -== mod _rewrite ==47 +== mod//rewrite// == 46 46 47 -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.// 48 48 49 -Aaron Rosenzweig has a very thorough article about [[using mod _rewrite with Apache>>url:http://web.archive.org/web/20051216205025/http://www.jewelryluv.com/fashion/pageWithName/ModRewrite/||shape="rect"]][[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://www.jewelryluv.com/fashion/pageWithName/ModRewrite/]]. 50 50 51 -=== mod _rewrite with mod_webobjects ===53 +=== mod//rewrite with mod//webobjects === 52 52 53 -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).// 54 54 55 -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~:// 56 56 57 57 {{noformat}} 60 + 58 58 LoadModule WebObjects_module /System/Library/WebObjects/Adaptors/Apache/mod_WebObjects.so 59 59 LoadModule rewrite_module libexec/httpd/mod_rewrite.so 60 60 ... ... @@ -63,6 +63,7 @@ 63 63 , find again: 64 64 65 65 {{noformat}} 69 + 66 66 AddModule mod_WebObjects.c 67 67 AddModule mod_rewrite.c 68 68 ... ... @@ -72,9 +72,10 @@ 72 72 73 73 === Mike Schrag === 74 74 75 -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~:// 76 76 77 -{{code 0="xml"}} 81 +{{code value="xml"}} 82 + 78 78 <IfModule mod_rewrite.c> 79 79 RewriteEngine On 80 80 RewriteRule ^/$ /page/HomePage [R] ... ... @@ -85,31 +85,30 @@ 85 85 86 86 {{/code}} 87 87 88 -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}}.93 +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]]##. 89 89 95 +{{id value="Apache22Adapter"}}{{/id}} 90 90 91 - 92 -{{id name="Apache22Adapter"/}} 93 - 94 94 === Jeff Schmitz === 95 95 96 -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.99 +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. // 97 97 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. 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)105 +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>>http://wocommunity.org/documents/tools/mod_WebObjects/]] for various OS available) 103 103 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.107 +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. It works in all of my tests. 109 +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. 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. 111 +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 0="xml"}} 115 +{{code value="xml"}} 116 + 113 113 <Directory /> 114 114 Options FollowSymLinks 115 115 AllowOverride None ... ... @@ -119,47 +119,46 @@ 119 119 120 120 {{/code}} 121 121 122 -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. 126 +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 123 124 124 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. 125 125 126 126 {{info title="Note"}} 127 -The default {{code language="none"}}ScriptAlias{{/code}} directive in the 10.5 and 10.6 {{code language="none"}}httpd.conf{{/code}} files is: 128 128 129 -{{noformat}} 132 +The default {{ScriptAlias}} directive in the 10.5 and 10.6 {{httpd.conf}} files is: 133 +\\ 134 +{noformat} 130 130 ScriptAliasMatch ^/cgi-bin/((?!(?i:webobjects)).*$) "/Library/WebServer/CGI-Executables/$1" 136 +{noformat} 137 +This prevents {{/cgi-bin/WebObjects}} from matching, so no change to {{WebObjectsAlias}} or {{ScriptAlias}} is necessary. 131 131 132 -{{/noformat}} 133 - 134 -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. 135 135 {{/info}} 136 136 137 137 Other than these tips, it's pretty much the standard compilation and installation, and configuration. 138 138 139 -1. Alter the make.config file in the Adaptors directory of the Wonder repository to reflect your apache installation setup. *143 +1. Alter the make.config file in the Adaptors directory of the Wonder repository to reflect your apache installation setup. 140 140 1. Run make to build the Adaptor 141 -1. Curse because of that one setting you forgot. Fix it. 145 +1. Curse because of that one setting you forgot. Fix it. 142 142 1. make clean; make 143 -1. Install the mod _WebObjects module with apxs147 +1. Install the mod//WebObjects module with apxs// 144 144 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. 145 145 1. apachectl configtest; apachectl graceful 146 146 1. Test. 147 -1. Curse again. Change the httpd.conf file as necessary. 148 -1. apachectl graceful. Go to 8 as necessary. 149 -1. Finally !apachectl graceful151 +1. Curse again. Change the httpd.conf file as necessary. 152 +1. apachectl graceful. Go to 8 as necessary. 153 +1. Finally apachectl graceful 150 150 151 -Enjoy your shiny new WO adaptor. 155 +Enjoy your shiny new WO adaptor. :-) 152 152 153 -* ((( 154 -Note: if you are getting the error 157 +* Note: if you are getting the error 155 155 156 156 {{noformat}} 160 + 157 157 libtool: compile: unable to infer tagged configuration 158 158 libtool: compile: specify a tag with `--tag' 159 159 apxs:Error: Command failed with rc=65536 160 160 161 161 {{/noformat}} 162 -))) 163 163 164 164 Add to the end of your make.config the following: 165 - {{code language="none"}}CC = gcc{{/code}}168 +##CC = gcc##