0

我的 apache2 和 tomcat8 配置有一些问题。

<Virtualhost example.com>
JkMount /* ajp13_worker
ServerName example.com
DocumentRoot /opt/tomcat/public/my-webapp
ErrorLog /opt/tomcat/logs/error.log
CustomLog /opt/tomcat/logs/access.log common
<Directory /opt/tomcat/public/my-webapp>
    Options -Indexes
</Directory>

这个工作正常,因此来自 example.com 的每个请求都映射到 tomcat。

在同一台服务器上运行一个 kolab 邮件服务器,如果我尝试使用 example.com/anypath 登录到 example.com/roundcubemail 或其他 Web 服务,那么也会映射到我的 tomcat,这很糟糕。

我如何配置排除 example.com/anypath 的 apache2 ?

这是我的 example.com/roundcubemail 的虚拟主机,它不起作用:

<VirtualHost *:80>
Alias /roundcubemail /usr/share/roundcubemail/public_html/

别名 /webmail /usr/share/roundcubemail/public_html/

SetEnv no-gzip ExpiresActive On ExpiresDefault "access plus 1 month"

选项 +FollowSymLinks AllowOverride None

# php garbage collection for file-based sessions on debian is done via
# cronjob but roundcubemail uses mysql as storage during runtime which is
# not cleaned up by the cronjob. So reenable the default php gc method
php_admin_value session.gc_probability 1

<ifModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_URI}  ^/(roundcubemail|webmail)
    RewriteRule ^[a-zA-Z0-9]{16}/(.*) /%1/$1 [PT,L]
</ifModule>
<ifModule mod_authz_core.c>
    Require all granted
</ifModule>
<ifModule !mod_authz_core.c>
    Order Allow,Deny
    Allow from All
</ifModule>

谢谢4帮助:)

4

1 回答 1

0

如果您只想/roudncubemail使用 mod_jk 排除上下文路径映射到 Tomcat,您可以使用 JkUnmount 排除它:

JkUnmount /roundcubemail ajp13_worker
JkUnmount /roundcubemail/* ajp13_worker

这样,您的虚拟主机配置应该是这样的:

<Virtualhost example.com>
JkMount /* ajp13_worker
JkUnmount /roundcubemail ajp13_worker
JkUnmount /roundcubemail/* ajp13_worker
ServerName example.com
DocumentRoot /opt/tomcat/public/my-webapp
ErrorLog /opt/tomcat/logs/error.log
CustomLog /opt/tomcat/logs/access.log common
<Directory /opt/tomcat/public/my-webapp>
    Options -Indexes
</Directory>
</VirtualHost>
于 2018-02-05T14:29:01.117 回答