ubuntu下创建第一个rails应用程序

  一.创建一个新的应用程序

在控制台输入

> rails new  demo

 create  
      create  README.rdoc
      create  Rakefile
      create  config.ru
      create  .gitignore
      create  Gemfile
      create  app
...........
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
         run  bundle exec spring binstub --all
* bin/rake: spring inserted
* bin/rails: spring inserted

 demo文件建好了。


二.如何启动服务器

>cd demo 到demo文件夹下

启动本地web服务器 > rails server

=> Booting WEBrick
=> Rails 4.1.1 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
[2014-06-22 11:11:48] INFO  WEBrick 1.3.1
[2014-06-22 11:11:48] INFO  ruby 2.1.2 (2014-05-08) [x86_64-linux]
[2014-06-22 11:11:48] INFO  WEBrick::HTTPServer#start: pid=5313 port=3000

启动成功

三.通过浏览器访问服务器

此时打开浏览器输入URL http://localhost:3000/如果出现以下界面


OK,成功!

欲知后事如何,请听下回解说。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值