goal
Configure multiple Play 2.1 applications using nginx, using different subdirectories for each application.
App1 running on 127.0.0.1:4000 should be available at 127.0.0.1/dev
App2 running on 127.0.0.1:5000 should be available at 127.0.0.1/test
Configuration
nginx.conf
worker_processes 1; error_log logs/error.log; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; upstream app1 { server 127.0.0.1:4000; } upstream app2 { server 127.0.0.1:5000; } server { listen 80; server_name localhost; location /dev { rewrite /(.*) /$1 break; proxy_pass http://app1; } location /test { rewrite /(.*) /$1 break; proxy_pass http://app2; } } }
App1 - application.conf
application.context=/dev
App2 - application.conf
application.context=/test
Problem
In this configuration, I can access both applications, but only html code is loaded. All static files (css, js, images) are not loaded.
I think this is a caching problem. I tried with various nginx options, with no luck. If I request a site for the first time, the browser responds (for css and js files, for example 127.0.0.1/dev/assets/stylesheets/main.css ) with a status of 200 , but without content - Content-Length: 0 . Next time, he answers 304 , still without content.
I'm not sure if this is a nginx or Play 2.1 configuration issue.
I would appreciate any help.
source share