【问题标题】:Proxying play application代理播放应用程序
【发布时间】:2014-10-12 17:22:49
【问题描述】:

在我的服务器上,我已经安装了 Apache HTTPTomcat 并且需要部署我的 Play 应用程序。

我的 Apache HTTP 服务器的配置是这样的:

/etc/httpd/conf/httpd.conf 的末尾,我的线路代理了所有传入到 tomcat 的请求。而且很好。

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

现在,因为我还需要部署我的 Play 应用程序,所以我将以下内容放在上述最后两行之前:

<VirtualHost *:80>
    ProxyPreserveHost On
    ServerName localhost
    ProxyPass  /excluded !
    ProxyPass /my_play_app http://localhost:9000/my_play_app
    ProxyPassReverse /my_play_app http://localhost:9000/my_play_app
</VirtualHost>

问题是当我尝试使用此配置访问播放应用程序时,它没有响应。你能给我一些关于如何解决我的问题的提示吗?

提前致谢。

【问题讨论】:

    标签: apache proxy playframework playframework-2.1


    【解决方案1】:

    多年来,Apache 的出色表现令人赞叹不已,但我发现在提供静态资产和反向代理以分离正在运行的 HTTP 服务(例如 Play 应用程序)方面,nginx 轻巧、快速且可靠。

    p>

    我用于 Play 的 nginx 配置类似于:

    server {
        listen       80;
    
        # Without this, Play serves the assets from within it's bundled jar. That's
        # fine and works but seems unnecessary when nginx can serve the files directly.
        location /assets {
            alias /app/live/my-play-app-here/active/public;
        }
    
        location / {
            proxy_pass            http://localhost:9000;
            proxy_set_header      X-Real-IP  $remote_addr;
        }
    }
    

    This answer 有更多细节。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-01
      • 2013-01-18
      • 1970-01-01
      • 1970-01-01
      • 2012-03-01
      • 1970-01-01
      相关资源
      最近更新 更多