2
votes

I'm using Play framework 2.0. I'm creating a standalone app using "play dist".

Also I'm using Nginx as a frontend. So, I have Nginx config:

location /terra {
         proxy_pass http://127.0.0.1:9000;

         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;
     }

My routing file looks like:

GET /  controllers.Application.index()           
GET /projects     controllers.Application.projects()

When I start an application like

sh start -Dhttp.address=127.0.0.1 -Dhttp.port=9000

or just

sh start

and go to http://hostnamehere/terra I get: Action not found For request 'GET /terra'

If I change GET / controllers.Application.index() to GET /terra controllers.Application.index() - it doesn't work too.

Also when I run my app locally and go to "localhost:9000/WRONG_ROUTING_NAME" I get the same error, but I can see "These routes have been tried, in this order: " and the listing of the methods. I can't see the same listing after the app is deployed.

When I use curl myhost.com:9000 I get: curl: (52) Empty reply from server – Azee 12 secs ago edit

3

3 Answers

1
votes

The problem wasn't in routing. If you run play dist you get a standalone application. But you can run it only on the same local machine. It seems that "dist" also copies some config files somewhere. If you want to run a standalone application on the remote server you have to call play dist on that host. I couldn't find anything about that in Play docs. But I need this information to prepare debian packages...

1
votes

I figured out that to run app created by "dist" it is not enough to copy only created directory. You have to copy whole project directory with created one - unpacked from zip (or some specific files?) and run application from that directory.

0
votes

The problem was in different Java versions. The app was compiled using java 7, but the remote server was running the app on java 6.

I compiled and packed the app in java 6 and it solved the problem.

Now I'm using different architecture of web applications but that particular app is still running on 1.6.