apache服务器安装以及使用passenger插件部署rails应用,基于ubuntu 12.04 LTS

小例子可以部署在rails自带的WEBrick上,逐渐往后走还得上Apache。

安装apache服务器

命令是sudo apt-get install apache2

安装passenger插件

安装完毕还不能立刻用,因为想运行rails应用的话,还要为apache服务器安装插件passenger

passenger是一个gem包,安装命令是gem install passenger

passenger集成进Apache

执行命令passenger-install-apache2-module,进入安装程序。

abbuggy@abbuggy-ubuntu:~$ passenger-install-apache2-module
Welcome to the Phusion Passenger Apache 2 module installer, v3.0.18.

This installer will guide you through the entire installation process. It
shouldn't take more than 3 minutes in total.

Here's what you can expect from the installation process:

 1. The Apache 2 module will be installed for you.
 2. You'll learn how to configure Apache.
 3. You'll learn how to deploy a Ruby on Rails application.

Don't worry if anything goes wrong. This installer will advise you on how to
solve any problems.

Press Enter to continue, or Ctrl-C to abort.

回车确定之后,会进行依赖关系的检查,有部分内容不通过没有关系,回车之后会提示如何解决。

Checking for required software...

 * GNU C++ compiler... found at /usr/bin/g++
 * Curl development headers with SSL support... found
 * OpenSSL development headers... found
 * Zlib development headers... found
 * Ruby development headers... found
 * OpenSSL support for Ruby... found
 *
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
Phusion Passenger是一种基于Nginx或Apache应用服务器,它可以帮助我们快速、稳定地部署Rails应用。下面以Redmine为例,介绍在CentOS下如何使用Phusion Passenger方式部署Rails应用。 1. 安装必要的软件 首先需要安装Ruby、Rails、Nginx、Passenger等软件,可以使用以下命令: ``` sudo yum install epel-release sudo yum install ruby ruby-devel rubygems gcc gcc-c++ make sqlite-devel sudo gem install rails sudo gem install passenger ``` 2. 安装Nginx和Passenger 使用以下命令安装Nginx和Passenger: ``` sudo yum install nginx sudo passenger-install-nginx-module ``` 在安装过程中,需要选择“1. Yes: download, compile and install Nginx for me”选项,让Passenger自动编译和安装Nginx。 3. 配置Nginx和Passenger 默认情况下,Passenger会自动添加Nginx的配置文件并启动Nginx服务,但是我们需要手动修改Nginx配置文件。 找到Nginx的配置文件,一般是/etc/nginx/nginx.conf,添加以下内容: ``` http { # ... server { listen 80; server_name yourserver.com; root /path/to/your/redmine/public; passenger_enabled on; passenger_ruby /usr/bin/ruby; passenger_app_env production; } } ``` 其中,yourserver.com是你的服务器域名或IP地址,/path/to/your/redmine是你的Redmine应用所在路径。 4. 启动Nginx服务 启动Nginx服务: ``` sudo systemctl start nginx ``` 5. 配置数据库 修改/config/database.yml文件,配置Redmine连接数据库的相关信息。 6. 初始化Redmine 在Redmine目录下运行以下命令初始化数据库: ``` RAILS_ENV=production bundle exec rake db:create RAILS_ENV=production bundle exec rake db:migrate RAILS_ENV=production bundle exec rake redmine:load_default_data ``` 7. 启动Redmine 在Redmine目录下运行以下命令启动Redmine: ``` RAILS_ENV=production bundle exec rails server -e production ``` 现在你就可以在浏览器中输入yourserver.com访问Redmine了。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值