Changes for page Configuring Apache for WebObjects
Last modified by Aaron Rosenzweig on 2020/09/03 22:17
From 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
To 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
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki.p robert1 +XWiki.tedpet - Content
-
... ... @@ -1,19 +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 likely use Apache to server static resources. :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"}} 16 - 15 +{{code 0="xml"}} 17 17 <IfModule mod_expires.c> 18 18 ExpiresActive On 19 19 ExpiresDefault A60 ... ... @@ -28,8 +28,7 @@ 28 28 29 29 You will also need the corresponding type-extension mappings: 30 30 31 -{{code value="xml"}} 32 - 30 +{{code 0="xml"}} 33 33 <IfModule mod_mime.c> 34 34 AddType image/bmp bmp 35 35 AddType image/gif gif ... ... @@ -44,20 +44,19 @@ 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//==45 +== 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.//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. 50 50 51 -Aaron Rosenzweig has a very thorough article about [[using mod //rewrite with Apache//>>http://www.jewelryluv.com/fashion/pageWithName/ModRewrite/]].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"]]. 52 52 53 -=== mod //rewrite with mod//webobjects ===51 +=== mod_rewrite 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).//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). 56 56 57 -So in http.conf, search for mod //rewrite and change it to~://55 +So in http.conf, search for mod_rewrite and change it to: 58 58 59 59 {{noformat}} 60 - 61 61 LoadModule WebObjects_module /System/Library/WebObjects/Adaptors/Apache/mod_WebObjects.so 62 62 LoadModule rewrite_module libexec/httpd/mod_rewrite.so 63 63 ... ... @@ -66,7 +66,6 @@ 66 66 , find again: 67 67 68 68 {{noformat}} 69 - 70 70 AddModule mod_WebObjects.c 71 71 AddModule mod_rewrite.c 72 72 ... ... @@ -76,10 +76,9 @@ 76 76 77 77 === Mike Schrag === 78 78 79 -Here's an example mod //rewrite we use on one of our apps~://75 +Here's an example mod_rewrite we use on one of our apps: 80 80 81 -{{code value="xml"}} 82 - 77 +{{code 0="xml"}} 83 83 <IfModule mod_rewrite.c> 84 84 RewriteEngine On 85 85 RewriteRule ^/$ /page/HomePage [R] ... ... @@ -90,30 +90,31 @@ 90 90 91 91 {{/code}} 92 92 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]]##.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}}. 94 94 95 -{{id value="Apache22Adapter"}}{{/id}} 96 96 91 + 92 +{{id name="Apache22Adapter"/}} 93 + 97 97 === Jeff Schmitz === 98 98 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. //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. 100 100 101 101 == WebObjects Adaptor for Apache 2.2 == 102 102 103 103 === Travis Cripps === 104 104 105 -A number of people have expressed interest in using the WebObjects adaptor with Apache 2.2.x. 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) 106 106 107 -The necessary changes turned out to be mostly minor updates to change calls to outdated/deprecated functions. //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. 108 108 109 -I've tested with MacOS X 10.4.7, Apache 2.2.2, with and without ssl support. 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. 110 110 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. 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. 112 112 113 113 The new default configuration is: 114 114 115 -{{code value="xml"}} 116 - 112 +{{code 0="xml"}} 117 117 <Directory /> 118 118 Options FollowSymLinks 119 119 AllowOverride None ... ... @@ -123,46 +123,47 @@ 123 123 124 124 {{/code}} 125 125 126 -Your options are to comment out the last 2 lines of that block, or to override them in a VirtualHost block. 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. 127 127 128 128 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. 129 129 130 130 {{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: 131 131 132 -The default {{ScriptAlias}} directive in the 10.5 and 10.6 {{httpd.conf}} files is: 133 -\\ 134 -{noformat} 129 +{{noformat}} 135 135 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. 138 138 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. 139 139 {{/info}} 140 140 141 141 Other than these tips, it's pretty much the standard compilation and installation, and configuration. 142 142 143 -1. Alter the make.config file in the Adaptors directory of the Wonder repository to reflect your apache installation setup. 139 +1. Alter the make.config file in the Adaptors directory of the Wonder repository to reflect your apache installation setup.* 144 144 1. Run make to build the Adaptor 145 -1. Curse because of that one setting you forgot. 141 +1. Curse because of that one setting you forgot. Fix it. 146 146 1. make clean; make 147 -1. Install the mod //WebObjects module with apxs//143 +1. Install the mod_WebObjects module with apxs 148 148 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. 149 149 1. apachectl configtest; apachectl graceful 150 150 1. Test. 151 -1. Curse again. 152 -1. apachectl graceful. 153 -1. Finally 147 +1. Curse again. Change the httpd.conf file as necessary. 148 +1. apachectl graceful. Go to 8 as necessary. 149 +1. Finally! apachectl graceful 154 154 155 -Enjoy your shiny new WO adaptor. :-)151 +Enjoy your shiny new WO adaptor. 156 156 157 -* Note: if you are getting the error 153 +* ((( 154 +Note: if you are getting the error 158 158 159 159 {{noformat}} 160 - 161 161 libtool: compile: unable to infer tagged configuration 162 162 libtool: compile: specify a tag with `--tag' 163 163 apxs:Error: Command failed with rc=65536 164 164 165 165 {{/noformat}} 162 +))) 166 166 167 167 Add to the end of your make.config the following: 168 - ##CC = gcc##165 + {{code language="none"}}CC = gcc{{/code}}