play framework学习笔记之部署项目

    技术2022-05-20  33

     

    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的其他配置,暂时 略去。

     

     

     

     

     

     

     

     


    最新回复(0)