play framework学习笔记之 部署项目

Deployment options,部署的选择

1,

最简单和最健壮的项目部署方式是 without 容器

你可以把端口修改到80

You can use a frontal HTTP server like Lighttpd or Apache

当然你如果希望用到虚拟主机这样的功能,你也可以使用一些HTTP SERVER像apache,Lighttpd。让HTTP server转发。

 

2,部署在tomcat这样的servlet容器里面,支持tomcat6

需要打包成war

命令

play war myapp -o myapp.war

 

 

3,部署到GAE

安装play的GAE模块

play install gae

部署到GAE的命令

play gae:deploy myapp

 

项目部署的步骤

Set the framework in prod mode:

%production.application.mode=prod

 

Define a real database:

%production.db.url=jdbc:mysql://localhost/prod

%production.db.driver=com.mysql.jdbc.Driver

%production.db.user=root

%production.db.pass=1515312

 

 

Disable JPA automatic schema update:

%production.jpa.ddl=create

 

 

Define a secure secret key:

%production.application.secret=c12d1c59af499d20f4955d07255ed8ea333

 

 

 

 

 

log4j.rootLogger=ERROR, Rolling

log4j.logger.play=INFO

# Rolling files

log4j.appender.Rolling=org.apache.log4j.RollingFileAppender

log4j.appender.Rolling.File=application.log

log4j.appender.Rolling.MaxFileSize=1MB

log4j.appender.Rolling.MaxBackupIndex=100

log4j.appender.Rolling.layout=org.apache.log4j.PatternLayout

log4j.appender.Rolling.layout.ConversionPattern=%d{ABSOLUTE} %-5p ~ %m%n

 

%production.http.port=80

 

Set-up with lighttpd

 

This example shows you how to configure lighttpd as a front-end web server. Note that you can do the same with Apache, but if you only need virtual hosting or load balancing, lighttpd is a very good choice and much easier to configure!

The /etc/lighttpd/lighttpd.conf file should define things like this:

server.modules = (
      "mod_access",
      "mod_proxy",
      "mod_accesslog" 
)
...
$HTTP["host"] =~ "www.myapp.com" {
    proxy.balance = "round-robin" proxy.server = ( "/" =>
        ( ( "host" => "127.0.0.1", "port" => 9000 ) ) )
}
 
$HTTP["host"] =~ "www.loadbalancedapp.com" {
    proxy.balance = "round-robin" proxy.server = ( "/" => ( 
          ( "host" => "127.0.0.1", "port" => 9000 ), 
          ( "host" => "127.0.0.1", "port" => 9001 ) ) 
    )
}

 

 

Set-up with Apache

 

The example below shows a simple set-up with Apache httpd server running in front of a standard Play configuration.

LoadModule proxy_module modules/mod_proxy.so
...
<VirtualHost *:80>
  ProxyPreserveHost On
  ServerName www.loadbalancedapp.com
  ProxyPass / http://127.0.0.1:9000/
  ProxyPassReverse / http://127.0.0.1:9000/
</VirtualHost>
apache的其他配置,暂时 略去。


转载于:https://my.oschina.net/cder/blog/384458

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值