Last modified by Aaron Rosenzweig on 2020/09/03 22:17

From version 54.1
edited by Pascal Robert
on 2010/09/12 23:36
Change comment: There is no comment for this version
To version 57.1
edited by Pascal Robert
on 2012/02/11 08:44
Change comment: Migrated to Confluence 4.0

Summary

Details

Page properties
Title
... ... @@ -1,1 +1,1 @@
1 -Deployment-Apache
1 +Configuring Apache for WebObjects
Content
... ... @@ -1,18 +1,18 @@
1 1  == Overview ==
2 2  
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.
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". 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.
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. 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 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,17 +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]]##. 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.//
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://www.jewelryluv.com/fashion/pageWithName/ModRewrite/]].
51 +Aaron Rosenzweig has a very thorough article about [[using mod_rewrite with Apache>>url:http://www.jewelryluv.com/fashion/pageWithName/ModRewrite/||shape="rect"]].
52 52  
53 -=== mod//rewrite with mod//webobjects ===
53 +=== 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).//
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 56  
57 -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:
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~://
79 +Here's an example mod_rewrite we use on one of our apps:
80 80  
81 -{{code value="xml"}}
81 +{{code 0="xml"}}
82 82  
83 83  <IfModule mod_rewrite.c>
84 84   RewriteEngine On
... ... @@ -90,25 +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]]##.
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 94  
95 -{{id value="Apache22Adapter"}}{{/id}}
96 96  
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 +
97 97  == WebObjects Adaptor for Apache 2.2 ==
98 98  
99 99  === Travis Cripps ===
100 100  
101 -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://webobjects.mdimension.com/wonder/mod_WebObjects/]] for various OS available)
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 102  
103 -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.//
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 104  
105 -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.
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 106  
107 -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.
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 108  
109 109  The new default configuration is:
110 110  
111 -{{code value="xml"}}
117 +{{code 0="xml"}}
112 112  
113 113  <Directory />
114 114   Options FollowSymLinks
... ... @@ -119,37 +119,39 @@
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.
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 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"}}
133 +The default {{code language="none"}}ScriptAlias{{/code}} directive in the 10.5 and 10.6 {{code language="none"}}httpd.conf{{/code}} files is:\\
127 127  
128 -The default {{ScriptAlias}} directive in the 10.5 and 10.6 {{httpd.conf}} files is:\\
129 -{noformat}
135 +{{noformat}}
136 +
130 130  ScriptAliasMatch ^/cgi-bin/((?!(?i:webobjects)).*$) "/Library/WebServer/CGI-Executables/$1"
131 -{noformat}
132 -This prevents {{/cgi-bin/WebObjects}} from matching, so no change to {{WebObjectsAlias}} or {{ScriptAlias}} is necessary.
133 133  
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.
134 134  {{/info}}
135 135  
136 136  Other than these tips, it's pretty much the standard compilation and installation, and configuration.
137 137  
138 -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.*
139 139  1. Run make to build the Adaptor
140 -1. Curse because of that one setting you forgot. Fix it.
148 +1. Curse because of that one setting you forgot. Fix it.
141 141  1. make clean; make
142 -1. Install the mod//WebObjects module with apxs//
150 +1. Install the mod_WebObjects module with apxs
143 143  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.
144 144  1. apachectl configtest; apachectl graceful
145 145  1. Test.
146 -1. Curse again. Change the httpd.conf file as necessary.
147 -1. apachectl graceful. Go to 8 as necessary.
148 -1. Finally apachectl graceful
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
149 149  
150 -Enjoy your shiny new WO adaptor. :-)
158 +Enjoy your shiny new WO adaptor.
151 151  
152 -* Note: if you are getting the error
160 +* Note: if you are getting the error
153 153  
154 154  {{noformat}}
155 155  
... ... @@ -160,4 +160,4 @@
160 160  {{/noformat}}
161 161  
162 162  Add to the end of your make.config the following:
163 -##CC = gcc##
171 + {{code language="none"}}CC = gcc{{/code}}