Deploy two different games! applications on the same host name

I developed 2 applications with the Play Framework, referring to various information, so it makes no sense to merge while one application.

Now I need to deploy both applications on the same host name, each of which is in a separate subfolder (URI), for example: example.com/payment/ example.com/cms/

And I have problems with routes. I configured the nginx web server to work as a reverse proxy. It sends the first page as expected.

But as soon as I click on something, instead of going to / cms / Application / index, it refers to / Application / index (without / cms /).

IMHO I believe that I need to change the routes file, hardcoding / cms / in all paths, but this seems like a bad approach, because if I need to deploy APP on a different URI, I will need to change the routes again.

What is the best way to deploy two applications on the same name?

----- 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 ----- 
+6
nginx deployment playframework
source share
1 answer

If you look at this thread in Google Groups, you will see that the preferred approach relates to the context path.

The recommendation is to use the boot task to set the context for each application as follows.

 Play.ctxPath="/project1"; Router.detectChanges(Play.ctxPath); 

So your code will be

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

and etc.

+4
source share

All Articles