Apache + Tomcat:连接,但不是通过 mod_jk

Apache + Tomcat:连接,但不是通过 mod_jk

我的任务是安装一个新系统来接替旧系统的工作。旧系统是一个运行 Apache 和 Tomcat 以及其他一些服务的 Ubuntu 安装。新系统将是 Debian Squeeze,并保持最新的程序和安全更新。

我绝对不是 Apache 和 Tomcat 的专家,但我认为我明白要使这两者协同工作,您需要一个名为 mod_jk 的单独应用程序/模块。网上的大多数说明似乎都同意我的观点。

但是,检查旧安装后,我似乎找不到任何迹象表明 mod_jk 在哪里发挥作用。我期望的是

JkMount /* ajp13_worker

在 Apache 的任何配置文件中,最好是在 /etc/apache2/sites-available/* 中的任何一个中。

我已附加 /etc/apache2/sites-available/ourapp.oursite.tld.conf:

NameVirtualHost ourapp.oursite.tld:443
<VirtualHost ourapp.oursite.tld:443>
        ServerName ourapp.oursite.tld
        ServerAdmin [email protected]

        ErrorLog /var/log/apache2/ourapp.oursite.tld_ssl_error_log
        TransferLog /var/log/apache2/ourapp.oursite.tld_ssl_access_log

        SSLEngine on
        SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
        SSLCertificateFile /etc/apache2/ssl/servernew-public.key
        SSLCertificateKeyFile /etc/apache2/ssl/servernew-private.key

        <FilesMatch "\.(cgi|shtml|phtml|php3?)$">
            SSLOptions +StdEnvVars
        </FilesMatch>
        <Directory "/tmp">
            SSLOptions +StdEnvVars
        </Directory>

        SetEnvIf User-Agent ".*MSIE.*" \
           nokeepalive ssl-unclean-shutdown \
          downgrade-1.0 force-response-1.0

        CustomLog /var/log/apache2/ourapp.oursite.tld_ssl_request_log \
            "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

  DirectoryIndex index.jsp

  Redirect /webapps https://ourapp.oursite.tld/ourapp/
  Redirect /abs https://ourapp.oursite.tld:81
  Redirect / https://ourapp.oursite.tld/ourapp/

        ProxyRequests Off
        #ProxyVia On
        #ProxyPreserveHost On
        ProxyPass /ourapp http://127.0.0.1:8180/ourapp
        ProxyPassReverse /ourapp http://127.0.0.1:8180/ourapp
   ProxyPass /pbsEasyRequester http://127.0.0.1:8180/pbsEasyRequester
        ProxyPassReverse /pbsEasyRequester http://127.0.0.1:8180/pbsEasyRequester
   ProxyPass /ordertracking http://127.0.0.1:8180/ordertracking
        ProxyPassReverse /ordertracking http://127.0.0.1:8180/ordertracking

         <IfModule mod_deflate.c>
     #SetOutputFilter DEFLATE
   </IfModule>
</VirtualHost>

NameVirtualHost ourapp.oursite.tld:80
<VirtualHost ourapp.oursite.tld:80>
        ServerName ourapp.oursite.tld
        ErrorLog /var/log/apache2/ourapp.oursite.tld_error_log
        TransferLog /var/log/apache2/ourapp.oursite.tld_access_log

  Redirect /webapps https://ourapp.oursite.tld/ourapp/
  Redirect /abs https://ourapp.oursite.tld:81
  Redirect / https://ourapp.oursite.tld/ourapp/

        ProxyRequests Off
        #ProxyVia On
        #ProxyPreserveHost On
  ProxyPass /ourapp http://127.0.0.1:8180/ourapp
        ProxyPassReverse /ourapp http://127.0.0.1:8180/ourapp
        ProxyPass /pbsEasyRequester http://127.0.0.1:8180/pbsEasyRequester
        ProxyPassReverse /pbsEasyRequester http://127.0.0.1:8180/pbsEasyRequest
        ProxyPass /ordertracking http://127.0.0.1:8180/ordertracking
        ProxyPassReverse /ordertracking http://127.0.0.1:8180/ordertracking
</VirtualHost>

NameVirtualHost ourapp.oursite.tld:81
<VirtualHost ourapp.oursite.tld:81>
  ServerName ourapp.oursite.tld
  ErrorLog /var/log/apache2/ourapp.oursite.tld_joomla_error_log
  TransferLog /var/log/apache2/ourapp.oursite.tld_joomla_access_log

  DocumentRoot /var/www/joomla

        SSLEngine on
        SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
        SSLCertificateFile /etc/apache2/ssl/servernew-public.key
        SSLCertificateKeyFile /etc/apache2/ssl/servernew-private.key
        #SSLCACertificateFile /etc/apache2/ssl/ourapp.oursite.tld.crt
        <FilesMatch "\.(cgi|shtml|phtml|php3?)$">
            SSLOptions +StdEnvVars
        </FilesMatch>
        <Directory "/tmp">
            SSLOptions +StdEnvVars
        </Directory>
</VirtualHost>

我可以看到它指出默认文件是 index.jsp,但我不明白这个系统如何知道要使用 Tomcat。

如果您能给我一点提示,我将非常感激。我可以根据要求发布任何配置文件。

谢谢。

答案1

从外观上看,我猜测它是中间的 mod_proxy 部分:

ProxyPass /ourapp http://127.0.0.1:8180/ourapp
ProxyPassReverse /ourapp http://127.0.0.1:8180/ourapp
ProxyPass /pbsEasyRequester http://127.0.0.1:8180/pbsEasyRequester
ProxyPassReverse /pbsEasyRequester http://127.0.0.1:8180/pbsEasyRequest
ProxyPass /ordertracking http://127.0.0.1:8180/ordertracking
ProxyPassReverse /ordertracking http://127.0.0.1:8180/ordertracking

如果您在 Tomcat 服务器配置文件(我认为是 server.xml)中搜索“8180”,您可能会在其中找到“HTTP 连接器”条目。在这种情况下,Apache 实际上是在与 Tomcat 的内置 HTTP Web 服务器通信。

相关内容