2008/4/12, Shashidhar Rampally <[EMAIL PROTECTED]>:
> Francis,
>
>  I have followed your suggestion of using a <VirtualHost> but also made
>  use of a suggestion I found on a website which talked about putting
>  mod_rewrite rules inside the VirtualHost element along with the
>  JkMount command inside. And wow! it works great. :)) Thank you!
>

No problem :) But see below.

>  The only thing that's still unsolved is how do I redirect aboutus.html
>  permanently to aboutus.jsp (and 9 more such pages). I can follow the
>  same concept and put all those rules inside the VirtualHost, but I was
>  wondering if that would have performance implications? Is there anyway
>  I can .htaccess into play?
>
>  Thanks,
>  Shashi
>
>  <VirtualHost *:80>
>         JkMount /* ajp13

Why /*? Why not only /*.jsp? Apache is much better at serving static content...

Here is the Apache configuration file I use, from a server at home
(hence the RFC 1918 address and nonsensical domain name), you'll
notice that I don't use mod_rewrite at all and that one URL
(/favicon.ico) is redirected using RedirectMatch. You can use this
trick for your yet unredirected pages.

Before the end of the file, you'll see how I manage to redirect
another server name to the main one, it's dead simple. Again, no
mod_rewrite needed ;)

---- CUT ----
##########
# TOMCAT #
##########
#
# We use mod_jk for talking with Tomcat. Note that this module does NOT come
# from RHEL, but from JPackage.
#
LoadModule jk_module modules/mod_jk.so

#
# The JkWorkersFile is the location (starting from the ServerRoot) of the
# configuration file for mod_jk.
#
# In a traditional One2team setup, only one worker, of type AJP 1.3 and with
# name "ajp13" (see below), will be
# configured, and the Tomcat server will be on the same machine as Apache. In
# case you want load balancing at Tomcat level, this will be the file to modify.
#
# See the workers.properties file for details.
#
JkWorkersFile conf.d/workers.properties
JkLogFile logs/jk.log
JkLogLevel info

#
# This is what we want to handle to Tomcat. The rest is handled by Apache itself
# (Apache knows about KeepAlive, not Tomcat).
#
JkMount /*.jsp ajp13
JkMount /servlet/* ajp13

#
# We want minimal "Server" headers in HTTP responses.
#
ServerTokens Prod
ServerSignature off

#
# We have no user accounts. Just in case though, we don't want any ~user.
#
UserDir disabled

##############
# MAIN VHOST #
##############

#
# Our main vhost is SSL. Always.
#
NameVirtualHost 10.142.81.12:443

<VirtualHost frontend.kitchen.eel:443>

        ServerAdmin [EMAIL PROTECTED]
        DocumentRoot /var/lib/tomcat5/webapps/one2team
        ServerName frontend.kitchen.eel

        #
        # We want our logs in separate files. We also want a log format that is
        # actually useful!
        #
        ErrorLog logs/one2team-error_log
        LogFormat "%{%Y%m%d,%H:%M:%S}t %h (%>s/%c; %B bytes/%D usecs)
\"%r\"" one2team
        CustomLog logs/one2team-access_log one2team

        RedirectMatch permanent .*/favicon\.ico$
https://frontend.kitchen.eel/images/one2team.ico

        #
        # The SSL part... First, the directives for the SSL engine itself.
        #
        SSLEngine on
        SSLProtocol all -SSLv2
        SSLCipherSuite ALL:!ADH:RC4+RSA:+HIGH:-MEDIUM:-SSLv2:-LOW:-eNULL
        SSLOptions +StdEnvVars +ExportCertData

        #
        # Now the SSL certificate.
        #
        # IMPORTANT: the default installation provides the server with a
        # SELF-SIGNED CERTIFICATE. You may want to put a CA trusted certificate
        # instead. In this case, you should also provide a trust chain in
        # SSLCertificateChainFile.
        #
        # See the mod_ssl documentation for details.
        #
        SSLCertificateKeyFile conf/ssl.key/one2team.key
        SSLCertificateFile conf/ssl.crt/one2team.crt

        #
        # Expiry policy
        #
        ExpiresActive On
        ExpiresDefault "access plus 1 hour"
        AddDefaultCharset UTF-8

        #
        # Mod deflate: on the server side as well as on the client side...
        #
        SetOutputFilter DEFLATE
        SetInputFilter DEFLATE
        DeflateMemLevel 9
        DeflateCompressionLevel 3
        DeflateFilterNote Input instream
        DeflateFilterNote Output outstream
        DeflateFilterNote Ratio ratio
        #
        # But not for these types of files
        #
        SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
        SetEnvIfNoCase Request_URI \.mp3$ no-gzip dont-vary
        SetEnvIfNoCase Request_URI \.(?:exe|com)$ no-gzip dont-vary
        SetEnvIfNoCase Request_URI
\.(?:t?gz|zip|bz2|sit|rar|lha|Z|arc|jar|war)$ no-gzip dont-vary
        SetEnvIfNoCase Request_URI
\.(?:pdf|stc|std|sti|stw|sxc|sxd|sxg|sxi|sxm|sxw)$ no-gzip dont-vary

        #
        # Dynamic content: handle specially
        #
        <Location "/jsp">
                Header append Pragma "no-cache"
                #
                # We WANT the JSP content to expire immediately (it's dynamic
                # after all)
                #
                ExpiresDefault "now"
                Header set Cache-Control "no-store, private, no-cache,
must-revalidate, proxy-revalidate"
                Header unset Vary
        </Location>

        <LocationMatch "/servlet">
                Header append Pragma "no-cache"
                ExpiresDefault "now"
                Header set Cache-Control "no-store, private, no-cache,
must-revalidate, proxy-revalidate"
                Header unset Vary
        </LocationMatch>

        <LocationMatch
"/servlet/(ShowDocumentContent|ShowBinary|DownloadServlet|ChartServlet)">
                Header set Cache-Control "private, must-revalidate,
proxy-revalidate, max-age=0"
                Header unset Pragma
        Header unset Vary
        </LocationMatch>

        #
        # Directories within the webapp root that we DO NOT want to be accessed
        # directly
        #
        <Location "/WEB-INF">
                AllowOverride None
                Order allow,deny
                Deny from all
        </Location>

        <Directory "/var/lib/tomcat5/webapps/one2team/WEB-INF">
                AllowOverride None
                Order allow,deny
                Deny from all
        </Directory>

        #
        # And finally, the webapp root directory
        #
        <Directory "/var/lib/tomcat5/webapps/one2team/">
                Options FollowSymLinks
        </Directory>

</VirtualHost>

#
# Redirect-only VHost
#

<VirtualHost cookiejar.kitchen.eel:80>
        ServerName cookiejar.kitchen.eel
        RedirectMatch permanent ^/(.*)$ https://frontend.kitchen.eel/$1
</VirtualHost>
---- CUT ----

I don't use mod_rewrite, as you can see.

-- 
Francis Galiegue, [EMAIL PROTECTED]
"When it comes to performance, weight is everything" - Tiff Needell

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to