Link to home
Create AccountLog in
Avatar of mevin
mevinFlag for United States of America

asked on

Apache Tomcat server setup

My company is trying to move its web server to a new host.  The site utilizes a Java applet, for user authentication.  The new host is a Linux VPS, running Cent OS 6.2.  Our existing server has it's web root under the tomcat directory.  For consistency sake, I've changed the new servers web root to the tomcat directory as well.  It used to live at: /home/username/public_html.  Now it's at usr/local/jakarta/apache-tomcat-5.5.35/ROOT/  

Now when we visit the IP of the dev server, instead of our normal PHP based site, we see the source code of the Tomcat administration page..  I know that we need to make edits to httpd.conf and some configuration files in the Tomcat directory.  But I'm not sure exactly where to go for Tomcat, or if I need to edit any other files?

Can anyone point me in the right place for concise directions on how to configure an Apache Tomcat server, so that it serves normal HTML/PHP pages from port 80, but can also serve Java Applets on port 8080?  I hope that makes sense?

Thanks,

Mark
Avatar of arober11
arober11
Flag of United Kingdom of Great Britain and Northern Ireland image

Hi

Apache Tomcat is a Java container, so can only handle java / jsp and some static content, basically the port 8080 stuff.  Your plain HTML files and php will be served by Apache Httpd, and the Httpd server can be made to proxy on requests for java based content to the Tomcat instance, to join the dots.

As to what you need to do, first stop tomcat instance, then alter the port it's listening on, in it's server.xml file, to port 8080, from port 80, it will be specified in the connector block, and restart the tomcat instance. If you've also updated the init.d scripts to reflect the new directory structure you can use.

/etc/init.d/tomcat stop
/etc/init.d/tomcat start

Next copy edit the apache httpd.conf to resemble that on your old server, and start the server. There should either be a: ProxyPass, JKmount or RewriteRule line to proxy traffic starting with a specific prefix to the tomcat instance on port 8080, and a ProxyPassReverse statement or two to sort out traffic comming the other way, along with a location or directory block controlling access to the tomcat mount point.

/etc/init.d/httpd restart

You'll also want to compare the php.ini files between servers.
Avatar of mevin

ASKER

arober11,

Thanks for your response.  I'm away from my work computer now, so I can't test anything.  But I'll let you know how it goes tomorrow.

Thanks,

Mark
SOLUTION
Avatar of singh677
singh677
Flag of India image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of mevin

ASKER

Hi guys,

Sorry it's taken me so long to post on this thread.  I had an emergency with another site that I had to deal with for the last few days, and I couldn't work on this.

I've got this partially working.  When I include port 8080 in the url, the servlet works.  But when I leave it out, I see the index of the WEB-INF directory, inside the main servlet directory.

Here's are the pertinent configuration files:

httpd.conf file: (just the tomcat stuff)

LoadModule jk_module modules/mod_jk.so
# Include "/usr/local/jakarta/apache-tomcat-5.5.35/conf/mod_jk.conf"

# Include /usr/local/jakarta/apache-tomcat-5.5.35/conf/auto/mod_jk.conf

JkWorkersFile "/usr/local/jakarta/apache-tomcat-5.5.35/conf/jk/workers.properties"

<IfModule !mod_jk.c>
  LoadModule jk_module "/usr/local/apache/modules/mod_jk.so"
</IfModule>

JkLogFile "/usr/local/jakarta/apache-tomcat-5.5.35/logs/mod_jk.log"
JkLogLevel debug
Alias /seamlesslogin/login /usr/local/jakarta/apache-tomcat-5.5.35/webapps/seamlesslogin 

JkMount /seamlesslogin/login seamlessWorker  
JkMount /seamlesslogin/* seamlessWorker
<Location "/seamlesslogin/WEB-INF/"> 
AllowOverride None
deny from all 
</Location>

Open in new window



server.xml:

<?xml version="1.0" encoding="UTF-8"?>
<Server port="8005" shutdown="SHUTDOWN">
  <Listener className="org.apache.catalina.core.AprLifecycleListener" />
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>
  <Listener className="org.apache.jk.config.ApacheConfig" modJk="/usr/local/apache/modules/mod_jk.so" />
  <!-- 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" readonly="true" />
  </GlobalNamingResources>
  <Service name="Catalina">
    <Connector className="org.apache.ajp.tomcat4.Ajp13Connector" port="8080" 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" />
    <Engine name="Catalina" defaultHost="localhost">
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase"/>
      <Host name="localhost" appBase="webapps"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false"></Host>
    </Engine>
  </Service>
</Server>

Open in new window



workers.properties:

worker.list=seamlessWorker
worker.seamlessWorker.port=8009
worker.seamlessWorker.host=localhost
worker.seamlessWorker.type=ajp13

Open in new window


Any ideas?

Thanks!
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of mevin

ASKER

Tried both of those solutions and it's still not working without the port in the url?
What's appeared in your JkLogFile, when you tried to access /seamlesslogin?

Also if you have time try temporarily commenting out the JkMount statements, and adding the following HTTP reverse proxy block in as a test / alternitive:

ProxyRequests Off
ProxyPass        /seamlesslogin         http://localhost:8080/seamlesslogin
ProxyPassReverse /seamlesslogin   http://localhost:8080/seamlesslogin
<Proxy *>
Order deny,allow
Allow from all
</Proxy>

Open in new window


I'm assuming that's the URL your using to access the tomcat.
Avatar of mevin

ASKER

That code edit didn't work.  But here's the last few lines of the mod_jk.log:

[Mon Nov 19 12:20:01 2012] [27976:139940892723136] [debug] jk_translate::mod_jk.c (3605): missing uri map for host.mydomain.com:/whm-server-status
[Mon Nov 19 12:20:01 2012] [27976:139940892723136] [debug] jk_map_to_storage::mod_jk.c (3773): missing uri map for host.mydomain.com:/whm-server-status
[Mon Nov 19 12:20:01 2012] [27976:139940892723136] [debug] jk_translate::mod_jk.c (3605): missing uri map for host.mydomain.com:/500.shtml
[Mon Nov 19 12:20:01 2012] [27976:139940892723136] [debug] jk_map_to_storage::mod_jk.c (3773): missing uri map for host.mydomain.com:/500.shtml
[Mon Nov 19 12:20:01 2012] [27976:139940892723136] [debug] jk_translate::mod_jk.c (3605): missing uri map for host.mydomain.com:/index.php/500.shtml
[Mon Nov 19 12:20:01 2012] [27976:139940892723136] [debug] jk_map_to_storage::mod_jk.c (3773): missing uri map for host.mydomain.com:/index.php/500.shtml
[Mon Nov 19 12:20:01 2012] [27976:139940892723136] [debug] jk_translate::mod_jk.c (3605): missing uri map for host.mydomain.com:/500.shtml
[Mon Nov 19 12:20:01 2012] [27976:139940892723136] [debug] jk_map_to_storage::mod_jk.c (3773): missing uri map for host.mydomain.com:/500.shtml

Open in new window

* I had to change our actual domain to "mydomain.com" for security reasons

Thanks
In the apache httpd.conf, whats the Document Root set two, and is there a corresponding <Directory /.....>  block for that directory?
Avatar of mevin

ASKER

The document root is: /home/bomcp/public_html

The directory block is:
<directory /home/bomcp/public_html/>
AllowOverride All
Options +FollowSymLinks
Options +Indexes
allow from all
</directory>

Open in new window

All the bits on their own looks ok, can you please confirm where in your httpd.conf or sub conf file your sticking the reveres proxy elements?

Also do you have any virtual host definitions in your httpd.conf?  If you do the jkmount / proxy pass block will need to be in the applicable virtual host block.

If your still having problems can you navigate around the app using the working port 8080, direct access methon and note the URL structure, are all url's of the form  http://127.0.0.1/seamlesslogin/xxxxxxx ?

If  not you'll nee a few more mappings to cover the other options.
Avatar of mevin

ASKER

We're definitely defining virtual hosts, but we don't have any reverse proxy elements. Here's my entire httpd.conf file:

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#   Direct modifications to the Apache configuration file may be lost upon subsequent regeneration of the       #
#   configuration file. To have modifications retained, all modifications must be checked into the              #
#   configuration system by running:                                                                            #
#       /usr/local/cpanel/bin/apache_conf_distiller --update                                                    #
#   To see if your changes will be conserved, regenerate the Apache configuration file by running:              #
#       /usr/local/cpanel/bin/build_apache_conf                                                                 #
#   and check the configuration file for your alterations. If your changes have been ignored, then they will    #
#   need to be added directly to their respective template files.                                               #
#                                                                                                               #
#   It is also possible to add custom directives to the various "Include" files loaded by this httpd.conf       #
#   For detailed instructions on using Include files and the apache_conf_distiller with the new configuration   #
#   system refer to the documentation at: http://www.cpanel.net/support/docs/ea/ea3/customdirectives.html       #
#                                                                                                               #
#   This configuration file was built from the following templates:                                             #
#     /var/cpanel/templates/apache2/main.default                                                                #
#     /var/cpanel/templates/apache2/main.local                                                                  #
#     /var/cpanel/templates/apache2/vhost.default                                                               #
#     /var/cpanel/templates/apache2/vhost.local                                                                 #
#     /var/cpanel/templates/apache2/ssl_vhost.default                                                           #
#     /var/cpanel/templates/apache2/ssl_vhost.local                                                             #
#                                                                                                               #
#  Templates with the '.local' extension will be preferred over templates with the '.default' extension.        #
#  The only template updated by the apache_conf_distiller is main.default.                                      #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #


Include "/usr/local/apache/conf/includes/pre_main_global.conf"
Include "/usr/local/apache/conf/includes/pre_main_2.conf"

 

LoadModule fastinclude_module modules/mod_fastinclude.so
LoadModule auth_passthrough_module modules/mod_auth_passthrough.so
LoadModule bwlimited_module modules/mod_bwlimited.so
LoadModule frontpage_module modules/mod_frontpage.so


LoadModule jk_module modules/mod_jk.so
# Include "/usr/local/jakarta/apache-tomcat-5.5.35/conf/mod_jk.conf"

# Include /usr/local/jakarta/apache-tomcat-5.5.35/conf/auto/mod_jk.conf

JkWorkersFile "/usr/local/jakarta/apache-tomcat-5.5.35/conf/jk/workers.properties"

<IfModule !mod_jk.c>
  LoadModule jk_module "/usr/local/apache/modules/mod_jk.so"
</IfModule>

JkLogFile "/usr/local/jakarta/apache-tomcat-5.5.35/logs/mod_jk.log"
JkLogLevel debug
Alias /seamlesslogin/login /usr/local/jakarta/apache-tomcat-5.5.35/webapps/seamlesslogin 

JkMount /seamlesslogin/login seamlessWorker  
JkMount /seamlesslogin/* seamlessWorker
<Location "/seamlesslogin/WEB-INF/"> 
AllowOverride None
deny from all 
</Location>




# JkWorkersFile /usr/local/jakarta/apache-tomcat-5.5.35/conf/workers.properties
# JkLogFile /usr/local/apache/logs/mod_jk.log
# JkLogLevel info
# JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# JkMount /seamlesslogin/* ajp13


# Include "/usr/local/apache/conf/jk.conf"
Include "/usr/local/apache/conf/php.conf"
Include "/usr/local/apache/conf/includes/errordocument.conf"
Include "/usr/local/apache/conf/modsec2.conf"


ErrorLog "logs/error_log"
DefaultType text/plain
ScriptAliasMatch ^/?controlpanel/?$ /usr/local/cpanel/cgi-sys/redirect.cgi
ScriptAliasMatch ^/?cpanel/?$ /usr/local/cpanel/cgi-sys/redirect.cgi
ScriptAliasMatch ^/?kpanel/?$ /usr/local/cpanel/cgi-sys/redirect.cgi
ScriptAliasMatch ^/?securecontrolpanel/?$ /usr/local/cpanel/cgi-sys/sredirect.cgi
ScriptAliasMatch ^/?securecpanel/?$ /usr/local/cpanel/cgi-sys/sredirect.cgi
ScriptAliasMatch ^/?securewhm/?$ /usr/local/cpanel/cgi-sys/swhmredirect.cgi
ScriptAliasMatch ^/?webmail/?$ /usr/local/cpanel/cgi-sys/wredirect.cgi
ScriptAliasMatch ^/?whm/?$ /usr/local/cpanel/cgi-sys/whmredirect.cgi

RewriteEngine on
AddType text/html .shtml

Alias /akopia /usr/local/cpanel/3rdparty/interchange/share/akopia/
Alias /bandwidth /usr/local/bandmin/htdocs/
Alias /img-sys /usr/local/cpanel/img-sys/
Alias /interchange /usr/local/cpanel/3rdparty/interchange/share/interchange/
Alias /interchange-5 /usr/local/cpanel/3rdparty/interchange/share/interchange-5/
Alias /java-sys /usr/local/cpanel/java-sys/
Alias /mailman/archives /usr/local/cpanel/3rdparty/mailman/archives/public/
Alias /pipermail /usr/local/cpanel/3rdparty/mailman/archives/public/
Alias /sys_cpanel /usr/local/cpanel/sys_cpanel/


ScriptAlias /cgi-sys /usr/local/cpanel/cgi-sys/
ScriptAlias /mailman /usr/local/cpanel/3rdparty/mailman/cgi-bin/


<Directory "/">
    Options All
    AllowOverride All
</Directory>

<Directory "/usr/local/apache/htdocs">
    Options Includes Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all

</Directory>

<Files ~ "^error_log$">
    Order allow,deny
    Deny from all

    Satisfy All
</Files>

<FilesMatch "^\.ht">
    Order allow,deny
    Deny from all

    Satisfy All
</FilesMatch>

<IfModule log_config_module>
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    CustomLog logs/access_log common

    <IfModule logio_module>
        LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio

    </IfModule>

</IfModule>

<IfModule alias_module>
    ScriptAlias /cgi-bin/ "/usr/local/apache/cgi-bin/"

</IfModule>

<Directory "/usr/local/apache/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all

</Directory>

<IfModule mime_module>
    TypesConfig conf/mime.types
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

</IfModule>

<IfModule mod_log_config.c>
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common
    LogFormat "%{Referer}i -> %U" referer
    LogFormat "%{User-agent}i" agent

    CustomLog logs/access_log common

</IfModule>

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#   Direct modifications to the Apache configuration file may be lost upon subsequent regeneration of the       #
#   configuration file. To have modifications retained, all modifications must be checked into the              #
#   configuration system by running:                                                                            #
#       /usr/local/cpanel/bin/apache_conf_distiller --update                                                    #
#   To see if your changes will be conserved, regenerate the Apache configuration file by running:              #
#       /usr/local/cpanel/bin/build_apache_conf                                                                 #
#   and check the configuration file for your alterations. If your changes have been ignored, then they will    #
#   need to be added directly to their respective template files.                                               #
#                                                                                                               #
#   It is also possible to add custom directives to the various "Include" files loaded by this httpd.conf       #
#   For detailed instructions on using Include files and the apache_conf_distiller with the new configuration   #
#   system refer to the documentation at: http://www.cpanel.net/support/docs/ea/ea3/customdirectives.html       #
#                                                                                                               #
#   This configuration file was built from the following templates:                                             #
#     /var/cpanel/templates/apache2/main.default                                                                #
#     /var/cpanel/templates/apache2/main.local                                                                  #
#     /var/cpanel/templates/apache2/vhost.default                                                               #
#     /var/cpanel/templates/apache2/vhost.local                                                                 #
#     /var/cpanel/templates/apache2/ssl_vhost.default                                                           #
#     /var/cpanel/templates/apache2/ssl_vhost.local                                                             #
#                                                                                                               #
#  Templates with the '.local' extension will be preferred over templates with the '.default' extension.        #
#  The only template updated by the apache_conf_distiller is main.default.                                      #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #


PidFile logs/httpd.pid
LockFile logs/accept.lock
# Defined in /var/cpanel/cpanel.config: apache_port
Listen 0.0.0.0:80
User nobody
Group nobody
ExtendedStatus On
ServerAdmin webmaster@mydomain.com
ServerName host.mydomain.com
LogLevel warn

# These can be set in WHM under 'Apache Global Configuration'
Timeout 300

ServerSignature On



<IfModule prefork.c>

</IfModule>

RewriteEngine on
RewriteMap LeechProtect prg:/usr/local/cpanel/bin/leechprotect
RewriteLock /usr/local/apache/logs/rewrite_lock

UserDir public_html

# DirectoryIndex is set via the WHM -> Service Configuration -> Apache Setup -> DirectoryIndex Priority
DirectoryIndex index.html.var index.htm index.html index.shtml index.xhtml index.wml index.perl index.pl index.plx index.ppl index.cgi index.jsp index.js index.jp index.php4 index.php3 index.php index.phtml default.htm default.html home.htm index.php5 Default.html Default.htm home.html

# SSLCipherSuite can be set in WHM under 'Apache Global Configuration'

SSLPassPhraseDialog  builtin
SSLSessionCache         dbm:/usr/local/apache/logs/ssl_scache
SSLSessionCacheTimeout  300
SSLMutex  file:/usr/local/apache/logs/ssl_mutex
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin

    # Defined in /var/cpanel/cpanel.config: apache_ssl_port
    Listen 0.0.0.0:443
    AddType application/x-x509-ca-cert .crt
    AddType application/x-pkcs7-crl .crl


AddHandler cgi-script .cgi .pl .plx .ppl .perl
AddHandler server-parsed .shtml
AddType text/html .shtml
AddType application/x-tar .tgz
AddType text/vnd.wap.wml .wml
AddType image/vnd.wap.wbmp .wbmp
AddType text/vnd.wap.wmlscript .wmls
AddType application/vnd.wap.wmlc .wmlc
AddType application/vnd.wap.wmlscriptc .wmlsc

<Location /whm-server-status>
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from 127.0.0.1
</Location>


<Location /server-status>
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from 10.10.4.0/23 10.20.4.0/22 10.30.4.0/22
</Location>

<Location /server-info>
    SetHandler server-info
    Order deny,allow
    Deny from all
    Allow from 10.10.4.0/23 10.20.4.0/22 10.30.4.0/22
</Location>


# SUEXEC is supported

Include "/usr/local/apache/conf/includes/pre_virtualhost_global.conf"
Include "/usr/local/apache/conf/includes/pre_virtualhost_2.conf"

# DO NOT EDIT. AUTOMATICALLY GENERATED.  IF YOU NEED TO MAKE A CHANGE PLEASE USE THE INCLUDE FILES.


NameVirtualHost 12.34.567.89:443
NameVirtualHost 12.34.567.89:80
NameVirtualHost 12.34.567.99:80
# NameVirtualHost 127.0.0.1:80
NameVirtualHost *

# DO NOT EDIT. AUTOMATICALLY GENERATED.  IF YOU NEED TO MAKE A CHANGE PLEASE USE THE INCLUDE FILES.

<VirtualHost 12.34.567.99:80>
    ServerName host.mydomain.com
    DocumentRoot /usr/local/apache/htdocs
    ServerAdmin webmaster@mydomain.com
    <IfModule mod_suphp.c>
        suPHP_UserGroup nobody nobody
    </IfModule>
</VirtualHost>


# Default vhost for unbound IPs


<VirtualHost *>
    ServerName host.mydomain.com
    DocumentRoot /home/bomcp/public_html
    ServerAdmin webmaster@mydomain.com
    <IfModule mod_suphp.c>
        suPHP_UserGroup nobody nobody
    </IfModule>
</VirtualHost>


# DO NOT EDIT. AUTOMATICALLY GENERATED.  IF YOU NEED TO MAKE A CHANGE PLEASE USE THE INCLUDE FILES.

<VirtualHost 12.34.567.89:80>
    ServerName mydomain.com
    ServerAlias www.mydomain.com
    DocumentRoot /home/bomcp/public_html
    ServerAdmin webmaster@mydomain.com
    UseCanonicalName Off
    CustomLog /usr/local/apache/domlogs/mydomain.com combined
    CustomLog /usr/local/apache/domlogs/mydomain.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
    ## User bomcp # Needed for Cpanel::ApacheConf
    <IfModule mod_suphp.c>
        suPHP_UserGroup bomcp bomcp
    </IfModule>
    <IfModule concurrent_php.c>
        php4_admin_value open_basedir "/home/bomcp:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"
        php5_admin_value open_basedir "/home/bomcp:/usr/lib/php:/usr/local/lib/php:/tmp"
    </IfModule>
    <IfModule !concurrent_php.c>
        <IfModule mod_php4.c>
            php_admin_value open_basedir "/home/bomcp:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"
        </IfModule>
        <IfModule mod_php5.c>
            php_admin_value open_basedir "/home/bomcp:/usr/lib/php:/usr/local/lib/php:/tmp"
        </IfModule>
        <IfModule sapi_apache2.c>
            php_admin_value open_basedir "/home/bomcp:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"
        </IfModule>
    </IfModule>
    <IfModule !mod_disable_suexec.c>
        <IfModule !mod_ruid2.c>
            SuexecUserGroup bomcp bomcp
        </IfModule>
    </IfModule>
    <IfModule mod_ruid2.c>
        RUidGid bomcp bomcp
    </IfModule>
    ScriptAlias /cgi-bin/ /home/bomcp/public_html/cgi-bin/


    # To customize this VirtualHost use an include file at the following location
    # Include "/usr/local/apache/conf/userdata/std/2/bomcp/mydomain.com/*.conf"

</VirtualHost>

# DO NOT EDIT. AUTOMATICALLY GENERATED.  IF YOU NEED TO MAKE A CHANGE PLEASE USE THE INCLUDE FILES.

<VirtualHost 12.34.567.89:80>
    ServerName staging.mydomain.com
    ServerAlias www.staging.mydomain.com
    DocumentRoot /home/bomcp/public_html/staging
    ServerAdmin webmaster@staging.mydomain.com
    UseCanonicalName Off
    CustomLog /usr/local/apache/domlogs/staging.mydomain.com combined
    CustomLog /usr/local/apache/domlogs/staging.mydomain.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
    ## User bomcp # Needed for Cpanel::ApacheConf
    <IfModule mod_suphp.c>
        suPHP_UserGroup bomcp bomcp
    </IfModule>
    <IfModule concurrent_php.c>
        php4_admin_value open_basedir "/home/bomcp:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"
        php5_admin_value open_basedir "/home/bomcp:/usr/lib/php:/usr/local/lib/php:/tmp"
    </IfModule>
    <IfModule !concurrent_php.c>
        <IfModule mod_php4.c>
            php_admin_value open_basedir "/home/bomcp:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"
        </IfModule>
        <IfModule mod_php5.c>
            php_admin_value open_basedir "/home/bomcp:/usr/lib/php:/usr/local/lib/php:/tmp"
        </IfModule>
        <IfModule sapi_apache2.c>
            php_admin_value open_basedir "/home/bomcp:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"
        </IfModule>
    </IfModule>
    <IfModule !mod_disable_suexec.c>
        <IfModule !mod_ruid2.c>
            SuexecUserGroup bomcp bomcp
        </IfModule>
    </IfModule>
    <IfModule mod_ruid2.c>
        RUidGid bomcp bomcp
    </IfModule>
    ScriptAlias /cgi-bin/ /home/bomcp/public_html/staging/cgi-bin/


    # To customize this VirtualHost use an include file at the following location
    # Include "/usr/local/apache/conf/userdata/std/2/bomcp/staging.mydomain.com/*.conf"

</VirtualHost>

# DO NOT EDIT. AUTOMATICALLY GENERATED.  IF YOU NEED TO MAKE A CHANGE PLEASE USE THE INCLUDE FILES.

<VirtualHost 12.34.567.99:80>
    ServerName lwtest.com
    ServerAlias www.lwtest.com
    DocumentRoot /home/lwtest/public_html
    ServerAdmin webmaster@lwtest.com
    UseCanonicalName Off
    CustomLog /usr/local/apache/domlogs/lwtest.com combined
    CustomLog /usr/local/apache/domlogs/lwtest.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
    ## User lwtest # Needed for Cpanel::ApacheConf
    <IfModule mod_suphp.c>
        suPHP_UserGroup lwtest lwtest
    </IfModule>
    <IfModule concurrent_php.c>
        php4_admin_value open_basedir "/home/lwtest:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"
        php5_admin_value open_basedir "/home/lwtest:/usr/lib/php:/usr/local/lib/php:/tmp"
    </IfModule>
    <IfModule !concurrent_php.c>
        <IfModule mod_php4.c>
            php_admin_value open_basedir "/home/lwtest:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"
        </IfModule>
        <IfModule mod_php5.c>
            php_admin_value open_basedir "/home/lwtest:/usr/lib/php:/usr/local/lib/php:/tmp"
        </IfModule>
        <IfModule sapi_apache2.c>
            php_admin_value open_basedir "/home/lwtest:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"
        </IfModule>
    </IfModule>
    <IfModule !mod_disable_suexec.c>
        <IfModule !mod_ruid2.c>
            SuexecUserGroup lwtest lwtest
        </IfModule>
    </IfModule>
    <IfModule mod_ruid2.c>
        RUidGid lwtest lwtest
    </IfModule>
    ScriptAlias /cgi-bin/ /home/lwtest/public_html/cgi-bin/


    # To customize this VirtualHost use an include file at the following location
    # Include "/usr/local/apache/conf/userdata/std/2/lwtest/lwtest.com/*.conf"

</VirtualHost>

# DO NOT EDIT. AUTOMATICALLY GENERATED.  IF YOU NEED TO MAKE A CHANGE PLEASE USE THE INCLUDE FILES.

# SSL
# DO NOT EDIT. AUTOMATICALLY GENERATED.  IF YOU NEED TO MAKE A CHANGE PLEASE USE THE INCLUDE FILES.

<VirtualHost 12.34.567.89:443>
    ServerName mydomain.com
    ServerAlias www.mydomain.com
    DocumentRoot /home/bomcp/public_html
    ServerAdmin webmaster@mydomain.com
    UseCanonicalName Off
    CustomLog /usr/local/apache/domlogs/mydomain.com combined
    CustomLog /usr/local/apache/domlogs/mydomain.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
    ## User bomcp # Needed for Cpanel::ApacheConf
    <IfModule mod_suphp.c>
        suPHP_UserGroup bomcp bomcp
    </IfModule>
    <IfModule concurrent_php.c>
        php4_admin_value open_basedir "/home/bomcp:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"
        php5_admin_value open_basedir "/home/bomcp:/usr/lib/php:/usr/local/lib/php:/tmp"
    </IfModule>
    <IfModule !concurrent_php.c>
        <IfModule mod_php4.c>
            php_admin_value open_basedir "/home/bomcp:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"
        </IfModule>
        <IfModule mod_php5.c>
            php_admin_value open_basedir "/home/bomcp:/usr/lib/php:/usr/local/lib/php:/tmp"
        </IfModule>
        <IfModule sapi_apache2.c>
            php_admin_value open_basedir "/home/bomcp:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"
        </IfModule>
    </IfModule>
    <IfModule !mod_disable_suexec.c>
        <IfModule !mod_ruid2.c>
            SuexecUserGroup bomcp bomcp
        </IfModule>
    </IfModule>
    <IfModule mod_ruid2.c>
        RUidGid bomcp bomcp
    </IfModule>
    ScriptAlias /cgi-bin/ /home/bomcp/public_html/cgi-bin/
    SSLEngine on
    
    SSLCertificateFile /etc/ssl/certs/www.mydomain.com.crt
    SSLCertificateKeyFile /etc/ssl/private/www.mydomain.com.key
	SSLCACertificateFile /etc/ssl/certs/www.mydomain.com.cabundle
    CustomLog /usr/local/apache/domlogs/mydomain.com-ssl_log combined
    SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
    <Directory "/home/bomcp/public_html/cgi-bin">
        SSLOptions +StdEnvVars
    </Directory>

    # To customize this VirtualHost use an include file at the following location
    # Include "/usr/local/apache/conf/userdata/ssl/2/bomcp/mydomain.com/*.conf"

</VirtualHost>

Include "/usr/local/apache/conf/includes/post_virtualhost_global.conf"
Include "/usr/local/apache/conf/includes/post_virtualhost_2.conf"

# DO NOT EDIT. AUTOMATICALLY GENERATED.  IF YOU NEED TO MAKE A CHANGE PLEASE USE THE INCLUDE FILES.

Open in new window


And here's my server.xml file.  
<?xml version="1.0" encoding="UTF-8"?>
<Server port="8005" shutdown="SHUTDOWN">
  
  <!-- Comment these entries out to disable JMX MBeans support used for the 
       administration web application -->
  <Listener className="org.apache.catalina.core.AprLifecycleListener" />
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>
  <Listener className="org.apache.jk.config.ApacheConfig" modJk="/usr/local/apache/modules/mod_jk.so" />
  
  <!-- 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" readonly="true" />
  </GlobalNamingResources>
  
  <!-- Define the Tomcat Stand-Alone Service -->
  <Service name="Catalina">
    <Connector port="8080" maxHttpHeaderSize="8192"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               connectionTimeout="20000" disableUploadTimeout="true" />
    
    <!-- Define a SSL HTTP/1.1 Connector on port 8443 -->
    
    <!-- className="org.apache.catalina.connector.http.HttpConnector" -->
    <!-- className="org.apache.coyote.tomcat4.CoyoteServerSocketFactory" -->
    
    <Connector SSLEnabled="true"
  		   acceptCount="100"
                   connectionTimeout="20000"
                   executor="tomcatThreadPool"
                   keyAlias="tomcat"
                   keystoreFile="/root/.keystore"
                   keystorePass="******"
                   maxKeepAliveRequests="15"
                   port="8443"
                   protocol="org.apache.coyote.http11.Http11Protocol"
                   redirectPort="8443"
                   scheme="https"
                   secure="true"/>
    
  
    
    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009" 
               enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
    
    <!-- Define the top level container in our container hierarchy -->
    <Engine name="Catalina" defaultHost="localhost">
      
      <!-- This Realm uses the UserDatabase configured in the global JNDI
           resources under the key "UserDatabase".  Any edits
           that are performed against this UserDatabase are immediately
           available for use by the Realm.  -->
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase"/>
      
      <!-- Define the default virtual host
           Note: XML Schema validation will not work with Xerces 2.2.
       -->
      <Host name="localhost" appBase="webapps"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false"></Host>
    </Engine>
  </Service>
</Server>

Open in new window

ASKER CERTIFIED SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of mevin

ASKER

I finally got this working.  What I did was move all the tomcat connector stuff to inside the virtual host block for port 443.  For some reason JkWorkersFile had to be specified outside of that block, or else it produced an error when I restarted apache.  

Here's my virtualhost block for 443:
<VirtualHost 12.34.567.89:443>
    ServerName ourdomain.com
    ServerAlias www.ourdomain.com
    DocumentRoot /home/ourusername/public_html
    ServerAdmin webmaster@ourdomain.com
    UseCanonicalName Off
    CustomLog /usr/local/apache/domlogs/ourdomain.com combined
    CustomLog /usr/local/apache/domlogs/ourdomain.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
    ## User ourusername # Needed for Cpanel::ApacheConf
    <IfModule mod_suphp.c>
        suPHP_UserGroup ourusername ourusername
    </IfModule>
    <IfModule concurrent_php.c>
        php4_admin_value open_basedir "/home/ourusername:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"
        php5_admin_value open_basedir "/home/ourusername:/usr/lib/php:/usr/local/lib/php:/tmp"
    </IfModule>
    <IfModule !concurrent_php.c>
        <IfModule mod_php4.c>
            php_admin_value open_basedir "/home/ourusername:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"
        </IfModule>
        <IfModule mod_php5.c>
            php_admin_value open_basedir "/home/ourusername:/usr/lib/php:/usr/local/lib/php:/tmp"
        </IfModule>
        <IfModule sapi_apache2.c>
            php_admin_value open_basedir "/home/ourusername:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp"
        </IfModule>
    </IfModule>
    <IfModule !mod_disable_suexec.c>
        <IfModule !mod_ruid2.c>
            SuexecUserGroup ourusername ourusername
        </IfModule>
    </IfModule>
    <IfModule mod_ruid2.c>
        RUidGid ourusername ourusername
    </IfModule>
    ScriptAlias /cgi-bin/ /home/ourusername/public_html/cgi-bin/
    SSLEngine on
    
    SSLCertificateFile /etc/ssl/certs/www.ourdomain.com.crt
    SSLCertificateKeyFile /etc/ssl/private/www.ourdomain.com.key
	SSLCACertificateFile /etc/ssl/certs/www.ourdomain.com.cabundle
    CustomLog /usr/local/apache/domlogs/ourdomain.com-ssl_log combined
    SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
    <Directory "/home/ourusername/public_html/cgi-bin">
        SSLOptions +StdEnvVars
    </Directory>
	
# Tomcat connector #
	
	JkLogFile "/usr/local/apache/logs/mod_jk.log"
    JkLogLevel info
    JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
#   JkMount /seamlesslogin/login ajp13
	JkMount /seamlesslogin/* ajp13
# End Tomcat connector #

    # To customize this VirtualHost use an include file at the following location
    # Include "/usr/local/apache/conf/userdata/ssl/2/ourusername/ourdomain.com/*.conf"

</VirtualHost>

Open in new window

Avatar of mevin

ASKER

arober11,

Thank you very much for all of your help.  I really appreciate you sticking with this thread.  You were very helpful!

Thanks,

Mark