httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hai.ngu...@groupe-glon.com
Subject [users@httpd] Config of Apache & Tomcat & jkmod
Date Wed, 10 Nov 2010 09:34:03 GMT
Hi  there
I am trying to set the config Apache & Tomcat with jkmod 
and I need your helps please

I have two web application app1 and app2 on the server Debian with Apache2 
+ Tomcat 5.5 + jk mod 1.2.26
this server  has 2 IP:  IP1 (internal IP = intranet = 192.168.35.8) and 
IP2 (external IP = internet = 212.xxx.xxx.xxx)
and I have somes domain which point to this server
        www.app1.com and www.app1.fr for application app1
        www.app2.com and www.app2.fr for application app2

My goal: Two applications will be accessed by differents ways:
1. by domain, for ex www.app1.com(fr) for any users (by internet). 
2. by IP, for ex http://ip1/app1 or http://ip1/app2 for *internal users*

My configuration actual:

-------------------- Tomcat:  (server.xml) --------------------
...
    <Connector port="8180" maxHttpHeaderSize="8192"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               connectionTimeout="20000" disableUploadTimeout="true" />
...
    <Connector port="8009" 
               enableLookups="false" redirectPort="8443" 
protocol="AJP/1.3" />
...
<Host name="www.app1.fr" debug="0" appBase="/var/lib/tomcat5.5/webapps/" 
unpackWARs="true">
<Logger className="org.apache.catalina.logger.FileLogger"
                 directory="logs"  prefix="app1." suffix=".txt" 
timestamp="true"/>
<Context path="" docBase="app1" debug="0" reloadable="true"/>
<Alias>www.app1.com</Alias>
</Host>

<Host name="www.app2.fr" appBase="/var/lib/tomcat5.5/webapps/" debug="0" 
unpackWARs="true">
<Logger className="org.apache.catalina.logger.FileLogger"
                 directory="logs"  prefix="app2." suffix=".txt" 
timestamp="true"/>
<Context path="" docBase="app2" debug="0" reloadable="true"/>
<Alias>www.app2.com</Alias>
</Host>

-------------------- Apache: (apache2.conf) --------------------
...
Include /etc/apache2/sites-enabled/
In there, i have 2 files:

www.app1.fr
        Alias /app1 /var/lib/tomcat5.5/webapps/app1
        Alias /app2 /var/lib/tomcat5.5/webapps/app2

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName www.app1.fr
        ServerAlias www.app1.com

        DocumentRoot /var/lib/tomcat5.5/webapps/app1

        JkMount / worker1
        JkMount /* worker1
        JkUnMount /*.gif worker1
        JkUnMount /*.jpg worker1
        JkUnMount /*.png worker1
        JkUnMount /*.pdf worker1
        JkUnMount /*.css worker1
        JkUnMount /*.js worker1

        DirectoryIndex index.jsp index.html
#       Globally deny access to the WEB-INF directory
        <LocationMatch ?.*WEB-INF.*?>
                deny from all
        </LocationMatch>
</VirtualHost>

www.app2.fr
<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName www.app2.fr
        ServerAlias www.app2.com

        DocumentRoot /var/lib/tomcat5.5/webapps/app2

        JkMount / worker1
        JkMount /* worker1
        JkUnMount /*.gif worker1
        JkUnMount /*.jpg worker1
        JkUnMount /*.png worker1
        JkUnMount /*.pdf worker1
        JkUnMount /*.css worker1
        JkUnMount /*.js worker1

        DirectoryIndex index.jsp index.html
#       Globally deny access to the WEB-INF directory
        <LocationMatch ?.*WEB-INF.*?>
                deny from all
        </LocationMatch>
</VirtualHost>


-------------------- jkmod 1.2.26 --------------------
jk.load
LoadModule jk_module /usr/lib/apache2/modules/mod_jk.so

JkWorkersFile /etc/apache2/workers.properties
JkLogFile /var/log/apache2/mod_jk.log
JkShmFile /var/log/apache2/mod_jk.shm
JkLogLevel warn 
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkRequestLogFormat "%w %V %T"

#JkOptions indicate to send SSL KEY SIZE
#JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories


workers.properties:
workers.tomcat_home=/usr/share/tomcat5.5
workers.java_home=/usr/lib/jvm/java-6-sun

ps=/
worker.list=worker1
worker.worker1.port=8009
worker.worker1.host=localhost
worker.worker1.type=ajp13
worker.worker1.lbfactor=1


with this above config? It seems work
but with request http://IP1/app2 => log other_vhosts_access.log is 
following:

www.app1.fr:80 my IP - - [06/Nov/2010:16:29:37 +0100] "GET /app2/index.jsp 
HTTP/1.1" 200 3206 "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; 
Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 
3.5.30729)" 

I think, with the good config,  it should be www.app2.fr instead of 
www.app1.fr
and I told myself, perhaps, that is not good configuration ...

Another question:
for local testing with the domain: I am on a machine Windows XP, the 
server is Debian but have no IP2 (not extranet IP = no internet)
Could I do this config by adding 4 lines in file 
c:\WINDOWS\system32\drivers\etc\hosts
ip1     www.app1.fr
ip1     www.app1.com
ip1     www.app2.fr
ip1     www.app2.com


Any help/idea will be appreciated deeply!!!
thanks very much
best regards
Hai

______________________________________________________________________
Avertissement concernant la confidentialité
Le contenu de cet envoi, privilégié et confidentiel, ne s'adresse qu'au(x) destinataire(s)
indiqué(s) ci-dessus. Il est interdit, par toute autre personne, de le divulguer, le communiquer
ou le reproduire. Si vous avez reçu cet envoi par erreur, veuillez supprimer ce message y
compris toute pièce jointe et en aviser l'expéditeur par courriel. 

Warning concerning confidentiality
The content of this e-mail is privileged and confidential and intended solely for its designated
recipient(s). Any dissemination, distribution or copying of this e-mail, other than by its
intended recipient, is strictly prohibited. If you have received this e-mail by error, you
should destroy this e-mail and its contents and kindly notify.
______________________________________________________________________
Mime
View raw message