newbie's question for Configuring Tomcat5 and Apache2 with Virtual Hosts using mod_jk

Discussion in 'HOWTO-Related Questions' started by strephon, Feb 27, 2006.

  1. strephon

    strephon New Member

    Hi, all

    I'm so newbie on Debian box.
    I have been following Popplewell's tutorial for configuring Apache and Tomcat with mod_jk.
    As a newbie, a tiny problem can make me frustrated.
    If anyone remember your newbie's sad memory, please help me.

    I got errors while I tried to do following steps:

    =======================================================
    root@myLinux:/usr/src/jakarta-tomcat-connectors-1.2.15-src/jk/native# ./buildconf.sh
    rm autom4te.cache
    libtoolize --force --automake --copy
    ./buildconf.sh: line 7: libtoolize: command not found
    aclocal
    ./buildconf.sh: line 11: aclocal: command not found
    autoheader
    ./buildconf.sh: line 13: autoheader: command not found
    automake -a --foreign --copy
    ./buildconf.sh: line 15: automake: command not found
    autoconf
    ./buildconf.sh: line 17: autoconf: command not found
    rm autom4te.cache

    =============================================

    Can anyone help me out?
    In order to create the custom configure file, what do I have to install on my Debian box before excuting "./buildconf.sh" ?

    Popplewell's tutorial url is:
    http://www.howtoforge.com/apache2_tomcat5_mod_jk_p2

    Thank you in advance.
     
  2. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    It seems as if you don't have any development tools installed. Please install at least gcc.
     
  3. strephon

    strephon New Member

    Thank you, Falko.

    But I have installed gcc and other development tools.
    Anyway, after I posted, I figured out.

    After install apache2-threaded-dev package, there was no problem.

    Thank you.
     
  4. daveyfx

    daveyfx New Member

    This is an excellent "how-to" - quite possibly the best one available.

    As far as configuring Tomcat virtual hosts goes, is it possible to configure a "catch all" in the host field? This would be similar to the Apache <VirtualHost> directive in which one can create a wildcard in the domain, such as *.whatever.com to point to the same document base. Is such a configuration available for Tomcat?
     
  5. badbug

    badbug New Member

    Tomcat requests hang

    Hi,

    I'm not sure if anyone's still watching this thread but I'd really appreciate any help you can give me with this setup. I followed all the instructions yet any jsp or servlet requests hang. The Java process sits at about 80-100% CPU consumption so I know it's doing something but I can't find anything in the logs.

    /usr/tomcat/default/conf/server.xml
    Code:
    <Server port="8005" shutdown="SHUTDOWN">
    
      <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
      <Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>
    
      <!-- Global JNDI resources -->
      <GlobalNamingResources>
    
        <!-- Test entry for demonstration purposes -->
        <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
    
        <!-- Editable user database that can also be used by
             UserDatabaseRealm to authenticate users -->
        <Resource name="UserDatabase" auth="Container"
                  type="org.apache.catalina.UserDatabase"
           description="User database that can be updated and saved"
               factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />
    
      </GlobalNamingResources>
    
    
      <!-- Define the Tomcat Stand-Alone Service -->
      <Service name="Catalina">
    
        <!-- A "Connector" represents an endpoint by which requests are received
             and responses are returned.  Each Connector passes requests on to the
             associated "Container" (normally an Engine) for processing.
        -->
    
        <!-- Define a non-SSL HTTP/1.1 Connector on port 2117 (default 8080) -->
        <Connector port="2117" maxHttpHeaderSize="8192"
                   maxThreads="150" minSpareThreads="5" maxSpareThreads="75"
                   enableLookups="false" redirectPort="8443" acceptCount="100"
                   connectionTimeout="20000" disableUploadTimeout="true" />
    
    
        <!-- Define an AJP 1.3 Connector on port 8009 -->
        <Connector port="8009"
                   enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
    
        <!-- Define a Proxied HTTP/1.1 Connector on port 8082 -->
        <!-- See proxy documentation for more information about using this. -->
        <!--
        <Connector port="8082"
                   maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
                   enableLookups="false" acceptCount="100" connectionTimeout="20000"
                   proxyPort="80" disableUploadTimeout="true" />
        -->
    
        <!-- An Engine represents the entry point (within Catalina) that processes
             every request.  The Engine implementation for Tomcat stand alone
             analyzes the HTTP headers included with the request, and passes them
             on to the appropriate Host (virtual host). -->
    
        <!-- Define the top level container in our container hierarchy -->
        <Engine name="Catalina" defaultHost="localhost">
    
          <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
                 resourceName="UserDatabase"/>
    
          <!-- Define the default virtual host -->
    
          <Host name="localhost" appBase="webapps"
           unpackWARs="true" autoDeploy="true"
           xmlValidation="false" xmlNamespaceAware="false">
    
            <Valve className="org.apache.catalina.valves.AccessLogValve"
                     directory="logs"  prefix="localhost_access_log." suffix=".txt"
                     pattern="common" resolveHosts="false"/>
          </Host>
    
          <!-- www.domain1.com -->
          <Host name="www.maskeddom.co.uk" appBase="/var/www/maskeddom/htdocs"
            unpackWARs="true" autoDeploy="true">
    
            <Valve className="org.apache.catalina.valves.AccessLogValve"
                     directory="/var/www/maskeddom/logs"  prefix="maskeddom_access_log." suffix=".txt"
                     pattern="common" resolveHosts="false"/>
          </Host>
    
          <Listener className="org.apache.jk.config.ApacheConfig"
                     modJk="/usr/lib/apache2/modules/mod_jk.so"
                     workersConfig="/etc/apache2/workers.properties"/>
    
        </Engine>
    
      </Service>
    
    </Server>
    

    /etc/apache2/sites-available/default
    Code:
    NameVirtualHost 123.45.67.89
    <VirtualHost www.maskeddom.co.uk>
            ServerAdmin niall@maskeddom.co.uk
            ServerName www.maskeddom.co.uk
            ServerAlias maskeddom.co.uk
    
            DirectoryIndex index.shtml
            DocumentRoot /var/www/maskeddom/htdocs
    
            <Directory /var/www/maskeddom/htdocs>
                    Options +Includes -Indexes
                    AllowOverride None
                    Order allow,deny
                    allow from all
                    AddType text/html .shtml
                    AddOutputFilter INCLUDES .shtml
            </Directory>
    
            ErrorLog /var/www/maskeddom/logs/error.log
    
            # Possible values include: debug, info, notice, warn, error, crit,
            # alert, emerg.
            LogLevel warn
    
            CustomLog /var/www/maskeddom/logs/access.log combined
            ServerSignature On
    
    
        # Forward servlets
        JkMount /*/servlet/* worker1
    
        # Forward JSPs
        JkMount /*.jsp worker1
    
    </VirtualHost>
    
    The other files I think are OK. Is there something here that's messing things up? Let me know if you need other files.

    I have changed the real public IP to 123.45.67.89 and the domain name to maskeddom.co.uk

    Thanks,

    Niall
     
  6. badbug

    badbug New Member

    Problem sorted

    Hi,

    I've been playing around with the server since my post and I've managed to get things working. I toyed around with the apache2 virtualhosts and restarted the java services and things seem to be ok now.

    Thanks anyways,

    Niall
     

Share This Page