Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Deployment 部署两个不同的游戏!相同主机名上的应用程序_Deployment_Nginx_Playframework - Fatal编程技术网

Deployment 部署两个不同的游戏!相同主机名上的应用程序

Deployment 部署两个不同的游戏!相同主机名上的应用程序,deployment,nginx,playframework,Deployment,Nginx,Playframework,我已经用Play Framework开发了两个应用程序,可以访问不同的信息,因此将它们合并为一个应用程序是没有意义的 现在,我需要在同一主机名上部署两个应用程序,每个应用程序都位于单独的子文件夹(URI)中,例如: example.com/payment/ example.com/cms/ 我的路线有问题。我配置了一个nginxwebserver作为反向代理。它按预期交付第一页 但一旦我点击了任何东西,它就会链接回/Application/index(不带/cms/),而不是/cms/Appli

我已经用Play Framework开发了两个应用程序,可以访问不同的信息,因此将它们合并为一个应用程序是没有意义的

现在,我需要在同一主机名上部署两个应用程序,每个应用程序都位于单独的子文件夹(URI)中,例如: example.com/payment/ example.com/cms/

我的路线有问题。我配置了一个nginxwebserver作为反向代理。它按预期交付第一页

但一旦我点击了任何东西,它就会链接回/Application/index(不带/cms/),而不是/cms/Application/index

我认为我需要更改所有路径上的路由文件,硬编码/cms/,但这似乎是一个糟糕的方法,因为如果我需要在另一个URI上部署应用程序,我将需要再次更改路由

在同一主机名上部署两个应用程序的最佳方式是什么

----- nginx.conf -----
...
...
...

    location /cms {
      proxy_pass      http://localhost:9001/;

      proxy_redirect          off;
      proxy_set_header        Host            $host;
      proxy_set_header        X-Real-IP       $remote_addr;
      proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    location /payment {
      proxy_pass      http://localhost:9002/;

      proxy_redirect          off;
      proxy_set_header        Host            $host;
      proxy_set_header        X-Real-IP       $remote_addr;
      proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    }

...
...
...
----- nginx.conf -----
如果你看一下Google群组,你会发现首选的方法是上下文路径

建议使用引导作业按以下方式设置每个应用程序的上下文

Play.ctxPath="/project1";
Router.detectChanges(Play.ctxPath);
所以你的代码是

Play.ctxPath="/cms";
Router.detectChanges(Play.ctxPath);
等等