在Mac上为Ruby on Rails设置本地web服务器

时间:2023-01-29 23:30:53

I use MAMP for PHP/MySQL.

我用MAMP来做PHP/MySQL。

What do I need for RoR?

对于RoR我需要什么?

I am using OS X Leopard. I have already installed Ruby, Gems and Rails.

我正在使用OS X Leopard。我已经安装了Ruby, Gems和Rails。

3 个解决方案

#1


5  

sudo gem install passenger will get you Phusion Passenger (mod_rails) which is pretty much the standard nowadays. There's a nice preference pane for managing the server on Mac OS X and a Railscast about it.

sudo gem安装passenger (sudo gem安装passenger)会给你带来Phusion passenger (mod_rails),这几乎是当今的标准。在Mac OS X上有一个很好的管理服务器的首选项窗格和一个Railscast。

Alternatively, sudo gem install mongrel to use the Mongrel server which you run using the script/server command and access on port 3000. Rails includes the basic WEBrick server, but most developers use Mongrel or Passenger.

另外,sudo gem安装mongrel以使用使用脚本/服务器命令运行的mongrel服务器并访问端口3000。Rails包含基本的WEBrick服务器,但大多数开发人员使用Mongrel或乘客。

#2


2  

Ruby on rails has a builtin web server (Webrick)

Ruby on rails有一个内置的web服务器(Webrick)

so you have only to create a rails project:

所以你只需要创建一个rails项目:

rails your_project
cd your_project

and start the server:

并启动服务器:

script/server

edit: also you can use mongrel instead of webrick by simply installing the gem

编辑:你也可以使用混搭而不是webrick通过安装宝石

(sudo) gem install mongrel 

if have a lot of apps that you want to run automatically at startup you sure can use Apache with Passenger (aka: mod_rack or mod_rails)

如果有很多应用程序需要在启动时自动运行你肯定可以使用Apache和Passenger(也叫:mod_rack或mod_rails)

and the Passenger Pane may be useful (tnx fingertips)

乘客窗格可能有用(tnx指尖)

#3


1  

You can simply run script/server to run a local web server for web development - there is no need to set up something like Apache. It will tell you the port it is listening at, and then you can just open that in your web browser.

您可以简单地运行脚本/服务器来运行web开发的本地web服务器——不需要设置类似Apache的东西。它会告诉你它正在监听的端口,然后你可以在你的浏览器中打开它。

You might want to install Mongrel (a faster Ruby server) by typing:

您可能希望通过输入:

sudo gem install mongrel

sudo gem安装杂种

Then script/server will use that instead of the default, WEBrick.

然后脚本/服务器将使用它而不是默认的WEBrick。

When deploying to production, you might be interested in something like Phusion Passenger, but it's much easier to develop applications using the built-in way.

当部署到生产时,您可能会对类似于Phusion的乘客感兴趣,但是使用内置的方式开发应用程序要容易得多。

#1


5  

sudo gem install passenger will get you Phusion Passenger (mod_rails) which is pretty much the standard nowadays. There's a nice preference pane for managing the server on Mac OS X and a Railscast about it.

sudo gem安装passenger (sudo gem安装passenger)会给你带来Phusion passenger (mod_rails),这几乎是当今的标准。在Mac OS X上有一个很好的管理服务器的首选项窗格和一个Railscast。

Alternatively, sudo gem install mongrel to use the Mongrel server which you run using the script/server command and access on port 3000. Rails includes the basic WEBrick server, but most developers use Mongrel or Passenger.

另外,sudo gem安装mongrel以使用使用脚本/服务器命令运行的mongrel服务器并访问端口3000。Rails包含基本的WEBrick服务器,但大多数开发人员使用Mongrel或乘客。

#2


2  

Ruby on rails has a builtin web server (Webrick)

Ruby on rails有一个内置的web服务器(Webrick)

so you have only to create a rails project:

所以你只需要创建一个rails项目:

rails your_project
cd your_project

and start the server:

并启动服务器:

script/server

edit: also you can use mongrel instead of webrick by simply installing the gem

编辑:你也可以使用混搭而不是webrick通过安装宝石

(sudo) gem install mongrel 

if have a lot of apps that you want to run automatically at startup you sure can use Apache with Passenger (aka: mod_rack or mod_rails)

如果有很多应用程序需要在启动时自动运行你肯定可以使用Apache和Passenger(也叫:mod_rack或mod_rails)

and the Passenger Pane may be useful (tnx fingertips)

乘客窗格可能有用(tnx指尖)

#3


1  

You can simply run script/server to run a local web server for web development - there is no need to set up something like Apache. It will tell you the port it is listening at, and then you can just open that in your web browser.

您可以简单地运行脚本/服务器来运行web开发的本地web服务器——不需要设置类似Apache的东西。它会告诉你它正在监听的端口,然后你可以在你的浏览器中打开它。

You might want to install Mongrel (a faster Ruby server) by typing:

您可能希望通过输入:

sudo gem install mongrel

sudo gem安装杂种

Then script/server will use that instead of the default, WEBrick.

然后脚本/服务器将使用它而不是默认的WEBrick。

When deploying to production, you might be interested in something like Phusion Passenger, but it's much easier to develop applications using the built-in way.

当部署到生产时,您可能会对类似于Phusion的乘客感兴趣,但是使用内置的方式开发应用程序要容易得多。