151 | | |
| 151 | == Run GSCF == |
| 152 | You should now be able to start tomcat and run the GSCF application: |
| 153 | |
| 154 | {{{ |
| 155 | root@nmcdsp:~# /etc/init.d/tomcat6 start |
| 156 | Starting Tomcat servlet engine: tomcat6. |
| 157 | root@nmcdsp:~# |
| 158 | }}} |
| 159 | |
| 160 | And check if it is running properly: |
| 161 | |
| 162 | {{{ |
| 163 | root@nmcdsp:~# lynx localhost http://localhost:8080/gscf-0.6.6-nmcdsptest |
| 164 | }}} |
| 165 | |
| 166 | == Set Up Apache to proxy / rewrite request == |
| 167 | As tomcat is running (by default) on 8080, it is not very professional to have your application run on http://test.mysite.com:8080/gscf-0.6.6-nmcdsptest. Instead http://test.mysite.com is preferable. Also it is convenient to be able to add load balancing functionality in case you expect high load. Apache can solve these issues. |
| 168 | |
| 169 | First, make sure Apache loads all modules we require: |
| 170 | {{{ |
| 171 | root@nmcdsp:~# cd /etc/apache2/mods-enabled/ |
| 172 | root@nmcdsp:/etc/apache2/mods-enabled# ln -s ../mods-available/proxy* . |
| 173 | root@nmcdsp:/etc/apache2/mods-enabled# ln -s ../mods-available/rewrite.load . |
| 174 | }}} |
| 175 | |
| 176 | Then create a new virtual host configuration for test.mysite.com and edit it: |
| 177 | {{{ |
| 178 | root@nmcdsp:/etc/apache2/mods-enabled# cd /etc/apache2/sites-available/ |
| 179 | root@nmcdsp:/etc/apache2/sites-available# nano mysite.com_gscf-test.conf |
| 180 | }}} |
| 181 | |
| 182 | Paste the following content into the virtual host configuration: |
| 183 | {{{ |
| 184 | # Apache Virtual Host for GSCF Test Build |
| 185 | # |
| 186 | # Author Jeroen Wesbeek <J****n.W******@gmail.com> |
| 187 | # Since 20100825 |
| 188 | # |
| 189 | # Revision Information: |
| 190 | # $Authoe$ |
| 191 | # $Date$ |
| 192 | # $Rev$ |
| 193 | # |
| 194 | <VirtualHost *:80> |
| 195 | ServerName test.mysite.com |
| 196 | ServerAlias test.gscf.mysite.com |
| 197 | |
| 198 | ErrorLog /var/log/apache2/gscf-test-error.log |
| 199 | CustomLog /var/log/apache2/gscf-test-access.log combined |
| 200 | |
| 201 | <IfModule mod_rewrite.c> |
| 202 | RewriteEngine on |
| 203 | |
| 204 | # keep listening for the serveralias, but redirect to |
| 205 | # servername instead to make sure only one user session |
| 206 | # is created (tomcat will create one user session per |
| 207 | # domain which may lead to two (or more) usersessions |
| 208 | # depending on the number of serveraliases) |
| 209 | # see gscf ticket #321 |
| 210 | RewriteCond %{HTTP_HOST} ^test.gscf.mysite.com$ [NC] |
| 211 | RewriteRule ^(.*)$ http://test.mysite.com$1 [R=301,L] |
| 212 | |
| 213 | # rewrite the /gscf-a.b.c-environment/ part of the url |
| 214 | RewriteCond %{HTTP_HOST} ^test.mysite.com$ [NC] |
| 215 | RewriteRule ^/gscf-0.6.6-nmcdsptest/(.*)$ /$1 [L,PT,NC,NE] |
| 216 | </IfModule> |
| 217 | |
| 218 | <IfModule mod_proxy.c> |
| 219 | <Proxy *> |
| 220 | Order deny,allow |
| 221 | Allow from all |
| 222 | </Proxy> |
| 223 | |
| 224 | ProxyStatus On |
| 225 | ProxyPass / balancer://gscf-cluster/gscf-0.6.6-nmcdsptest/ stickysession=JSESSIONID|jsessionid nofailover=On |
| 226 | ProxyPassReverse / balancer://gscf-cluster/gscf-0.6.6-nmcdsptest/ |
| 227 | ProxyPassReverseCookiePath /gscf-0.6.6-nmcdsptest / |
| 228 | |
| 229 | <Proxy balancer://gscf-cluster> |
| 230 | BalancerMember ajp://localhost:8009 |
| 231 | </Proxy> |
| 232 | </IfModule> |
| 233 | </VirtualHost> |
| 234 | |
| 235 | }}} |
| 236 | and press CTRL-X (and Y) to save |
| 237 | |
| 238 | |
| 239 | |
| 240 | |