2012-09-05 193 views
0

目前我正與JKMount和Alias Apache的配置問題。阿帕奇與JKMount和Alias

我安裝我的應用程序與JKMount

JkMount /app1/*.jsp app1 
    JkMount /app1/* app1 

我在我的本地文件系統上有一定的靜態圖像。

如果URL像http://testapp.com/app1/capture/testImg.jpg然後我不得不從我的C服務形象:/capture/testImg.jpg。

爲此,我使用AliasMatch

AliasMatch /app1/capture/(.*)$ C:/capture/img/$1 

這裏的問題在連詞與JKMount我不能使用AliasMatch。

如果我評論JKMount一部分,那麼我可以訪問圖像。但我的應用程序不起作用。

如果我取消JKMount部分我的應用程序工作,但我不能訪問圖像。

這是我在httpd.conf

NameVirtualHost testapp.com 
    <VirtualHost testapp.com:80> 
     ServerName testapp.com 
    DocumentRoot "Z:\TestApp\app1\src\main\webapp\public" 
    AliasMatch /app1/capture/(.*)$ C:/capture/img/$1 
    #<Directory C:/capture/img/> 
    # Order Deny,Allow 
    # Allow from all 
    #</Directory> 
    RewriteEngine on 
     RewriteRule ^/(.*) http://testapp.com/$1 [R=301,L] 
    JkMount /app1/*.jsp app1 
     JkMount /app1/* app1 


    <Directory C:/capture/img/> 
    Order Allow,Deny 
    Allow from all 
    </Directory> 

     ErrorLog "z:\logs\apache_error_log" 
     CustomLog "z:\logs\log_custom" combined 
    </VirtualHost> 

配置中的任何一個可以幫助我與上述問題

感謝

回答

4

我已經通過Apache Tomcat文檔不見了。

http://tomcat.apache.org/connectors-doc/webserver_howto/printer/apache.html

你可以使用無JK的環境變量與mod_alias中或mod_userdir指令時,JK和別名/用戶目錄中的網址匹配解決問題。

所以我的新httpd.config正在尋找這樣

NameVirtualHost testapp.com 
<VirtualHost testapp.com:80> 
    ServerName testapp.com 
    DocumentRoot "Z:\TestApp\app1\src\main\webapp\public" 
    #AliasMatch /app1/capture/(.*)$ C:/capture/img/$1 

    RewriteEngine on 
    RewriteRule ^/(.*) http://testapp.com/$1 [R=301,L] 
    SetEnvIf Request_URI "/app1/capture/*" no-jk 
    Alias /app1/capture/ C:/capture/img/ 

    <Directory C:/capture/img/> 
     Order Allow,Deny 
     Allow from all 
    </Directory> 


    JkMount /app1/*.jsp app1 
    JkMount /app1/* app1 

    ErrorLog "z:\logs\apache_error_log" 
    CustomLog "z:\logs\log_custom" combined 
</VirtualHost> 

了我的一切工作正常。