Python和tomcat在同一台机器上

时间:2022-03-25 18:16:34

using sec-web httpd. the python code has api: host/v0/auth/sessions/blablba... the java code has api: host/v0/auth/users/blabla.... there is a conf file on the machine which have the following for the python api:

使用sec-web httpd。 python代码有api:host / v0 / auth / sessions / blablba ... java代码有api:host / v0 / auth / users / blabla ....机器上有一个conf文件,其中包含以下内容: python api:

 ProxyPass                    /v0/auth/sessions http://localhost:8098/v0/auth/sessions
 ProxyPassReverse     /v0/auth/sessions http://localhost:8098/v0/auth/sessions

and for the java api:

对于java api:

ProxyPass               /   ajp://localhost:8009/
ProxyPassReverse        /   ajp://localhost:8009/

now: when I'm accessing the python api I'm getting good response, but when trying to access the java api I/m getting '[]' - the status code is 200 but I'm supposed to get a different response.

现在:当我访问python api时,我得到了很好的响应,但是当试图访问java api我/ m得到'[]'时 - 状态代码是200但我应该得到不同的响应。

any idea?

2 个解决方案

#1


0  

I had the similar task and I put into the config for java application the following apache config file:

我有类似的任务,我在java应用程序的配置中放入以下apache配置文件:

NameVirtualHost *:80

<VirtualHost *:80>
    ServerAdmin "mail@example.com"
    ServerName example.com
    ServerAlias www.example.com`

    ProxyRequests off
    ProxyPreserveHost on

    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>

    ProxyPass / http://127.0.0.1:8080/
    ProxyPassReverse / http://127.0.0.1:8080/
    <Location />
         Order allow,deny
         Allow from all
    </Location>

</VirtualHost>

Please note that http://example.com:8080/ opens java application. It is not http://example.com:8080/app/. Java application placed in the root of /var/lib/tomcat7/webapps/ dir as ROOT.jar (as for my tomcat).

请注意http://example.com:8080/打开java应用程序。它不是http://example.com:8080/app/。 Java应用程序放在/ var / lib / tomcat7 / webapps / dir的根目录下作为ROOT.jar(对于我的tomcat)。

#2


0  

In our server, we run Apache as proxy server and here is the sample, I hope it would help you.

在我们的服务器中,我们运行Apache作为代理服务器,这是示例,我希望它会对您有所帮助。

<IfModule mod_proxy.c>
ProxyRequests On
ProxyVia On


<Proxy http://localhost:8080/service>
        AddDefaultCharset off
        Order allow,deny
        Allow from all
</Proxy>

<Proxy http://localhost:8080/foo>
        AddDefaultCharset off
        Order allow,deny
        Allow from all
</Proxy>


<Location "/service">

    Order deny,allow
    Deny from all

    ProxyPass http://localhost:8080/service
    ProxyPassReverse http://localhost:8080/service
</Location>

<Location "/foo">

    Order deny,allow
    Deny from all

    ProxyPass http://localhost:8080/foo
    ProxyPassReverse http://localhost:8080/foo
</Location>

</IfModule>

#1


0  

I had the similar task and I put into the config for java application the following apache config file:

我有类似的任务,我在java应用程序的配置中放入以下apache配置文件:

NameVirtualHost *:80

<VirtualHost *:80>
    ServerAdmin "mail@example.com"
    ServerName example.com
    ServerAlias www.example.com`

    ProxyRequests off
    ProxyPreserveHost on

    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>

    ProxyPass / http://127.0.0.1:8080/
    ProxyPassReverse / http://127.0.0.1:8080/
    <Location />
         Order allow,deny
         Allow from all
    </Location>

</VirtualHost>

Please note that http://example.com:8080/ opens java application. It is not http://example.com:8080/app/. Java application placed in the root of /var/lib/tomcat7/webapps/ dir as ROOT.jar (as for my tomcat).

请注意http://example.com:8080/打开java应用程序。它不是http://example.com:8080/app/。 Java应用程序放在/ var / lib / tomcat7 / webapps / dir的根目录下作为ROOT.jar(对于我的tomcat)。

#2


0  

In our server, we run Apache as proxy server and here is the sample, I hope it would help you.

在我们的服务器中,我们运行Apache作为代理服务器,这是示例,我希望它会对您有所帮助。

<IfModule mod_proxy.c>
ProxyRequests On
ProxyVia On


<Proxy http://localhost:8080/service>
        AddDefaultCharset off
        Order allow,deny
        Allow from all
</Proxy>

<Proxy http://localhost:8080/foo>
        AddDefaultCharset off
        Order allow,deny
        Allow from all
</Proxy>


<Location "/service">

    Order deny,allow
    Deny from all

    ProxyPass http://localhost:8080/service
    ProxyPassReverse http://localhost:8080/service
</Location>

<Location "/foo">

    Order deny,allow
    Deny from all

    ProxyPass http://localhost:8080/foo
    ProxyPassReverse http://localhost:8080/foo
</Location>

</IfModule>