ubuntu搭建nginx+scala+play 2.0運行環境

來源:互聯網
上載者:User

ubuntu搭建nginx+scala+play 2.0運行環境 學scala有段時間了,最近用scala做了個社區:<a href="http://www.cn-scala.com" title="http://www.cn-scala.com"></a>,開始買了個記憶體512的vps,但是編譯都不通過,jvm提示無法為對象分配空間,囧,升級到1G,經過3個小時的奮戰,終於配置成功了,順便也記錄下。 <strong>1、安裝nginx,mysql</strong>編譯什麼的網上一大堆,就不細說了,大家可以google下。<strong>2、安裝JDK</strong><em>注意:ubuntu使用者請務必將OpenJDK替換成sunJDK</em> <em>[ubuntu使用者]</em>01sudo add-apt-repository ppa:ferramroberto/java02#如果上面命令提示:command not found,就輸入如下命令:sudo apt-get install python-software-properties03   www.2cto.com  04sudo apt-get update05sudo apt-get install sun-java6-jre sun-java6-plugin06sudo apt-get install sun-java6-jdk07 08update-alternatives --config java09#選擇jdk,輸入上面命令後會有3個選項,選擇第2個選項10  Selection    Path                                      Priority   Status11------------------------------------------------------------12* 0            /usr/lib/jvm/java-6-openjdk/jre/bin/java   1061      auto mode13  1            /usr/lib/jvm/java-6-openjdk/jre/bin/java   1061      manual mode14  2            /usr/lib/jvm/java-6-sun/jre/bin/java       63        manual mode <em>[非ubuntu使用者]</em>http://www.oracle.com/technetwork/java/javase/downloads/index.html解壓後我把檔案移動到了/usr/local/下
 修改/etc/profile檔案1export JAVA_HOME=/usr/local/jdk1.7.0_052  www.2cto.com  export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar3export PATH=$PATH:$JAVA_HOME/bin <strong>3、下載playframework檔案</strong>[cc lang="c"]http://www.playframework.org/[/cc]  3.1、安裝scala,只運行play2.0的話是可以不用安裝的。1http://www.scala-lang.org/   #下載debin包,如果安裝的openjdk的話可能出現缺少 janic2  www.2cto.com  dpkg -i scala-2.9.2.deb   3.2、安裝sbt  https://github.com/harrah/xsbt/wiki/Getting-Started-Setup  我是安裝ubuntu的方法安裝的,記得別忘了下載,不然會提示找不到sbt包  http://apt.typesafe.com/repo-deb-build-0002.deb1dpkg -i repo-deb-build-0002.deb2 apt-get update3 apt-get install sbt   安裝過程中可能需要點時間,完成後測試進入scala目錄測試  sbt 4、啟動play2.0項目 1play2start -Dhttp.port=9000 5、nginx設定代理01  www.2cto.com  server02        {03                listen       80;04                server_name *.cn-scala.com cn-scala.com;05 06                location /static {07                      root     /static/public;08                }09                location  / {10                    proxy_pass    http://127.0.0.1:9000;11                    proxy_set_header Host $host;12                    proxy_set_header X-Real-IP $remote_addr;13                }14        }  作者 冰雨心

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.