简体   繁体   中英

Deploying a Play Framework application on port 80 beside Apache

I'm looking for a way to deploy my Play-Framework-1.0 application on the port 80. So first I made the zip file with 'dist' command, then I unzipped it. When I run the command to lauch the application ( play-java-1.0-SNAPSHOT/bin/play-java -Dhttp.port=80 -Dhttp.adresse=127.0.0.1 ), I get this error :

[error] p.c.s.NettyServer - Failed to listen for HTTP on /0.0.0.0:80!
Oops, cannot start the server.
play.core.server.ServerListenException: Failed to listen for HTTP on /0.0.0.0:80!
at play.core.server.NettyServer.play$core$server$NettyServer$$bindChannel(NettyServer.scala:215)
at play.core.server.NettyServer$$anonfun$1.apply(NettyServer.scala:203)
at play.core.server.NettyServer$$anonfun$1.apply(NettyServer.scala:203)
at scala.Option.map(Option.scala:146)
at play.core.server.NettyServer.<init>(NettyServer.scala:203)
at play.core.server.NettyServerProvider.createServer(NettyServer.scala:266)
at play.core.server.NettyServerProvider.createServer(NettyServer.scala:265)
at play.core.server.ServerProvider$class.createServer(ServerProvider.scala:25)
at play.core.server.NettyServerProvider.createServer(NettyServer.scala:265)
at play.core.server.ProdServerStart$.start(ProdServerStart.scala:53)
at play.core.server.ProdServerStart$.main(ProdServerStart.scala:22)
at play.core.server.ProdServerStart.main(ProdServerStart.scala)

Moreover, in the real server, Apache has been installed. So I wonder, whether that will be a problem.

Thanks!

另外,还可以选择记住,在大多数系统上,默认情况下在低于8000的端口上运行进程是禁用的,在这种情况下,您需要允许它,即在Unix服务器上,仅使用sudo command(prefix)。

It's not possible to have two processes running on the same host listening on the same port.

However, you could run you Play application on different port, eg 8080 and set up Apache as a reverse proxy (Nginx would do too, but you mentioned that you already have Apache running on the server) to forward requests to your Play application.

Example guide how to do that: https://www.digitalocean.com/community/tutorials/how-to-use-apache-http-server-as-reverse-proxy-using-mod_proxy-extension

If you are using a Linux server, you can try ' fuser 80/tcp ' to see whether another process is already running on that port (80). If so (there's showing a process-id, when you enter the command), you cannot use the same port for 2 processes.

Either, you have to start the Play-app in a different port or you can kill the already running process by ' sudo fuser -k 80/tcp ' and start the Play-app on the same port (80).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM