Ubuntu下Apache服务器安装以及使用Passenger插件部署

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,进入安装程序。

@linuxidc-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 
 * RubyGems... found 
 * Rake... found at /home/linuxidc/.rvm/wrappers/ruby-1.9.2-p320/rake 
 * rack... found 
 * Apache 2... found at /usr/sbin/apache2 
 * Apache 2 development headers... not found 
 * Apache Portable Runtime (APR) development headers... not found 
 * Apache Portable Runtime Utility (APU) development headers... not found 
 
Some required software is not installed. 
But don't worry, this installer will tell you how to install them. 
 
Press Enter to continue, or Ctrl-C to abort. 

按照提示将缺少的依赖包,比如我缺少apache2-perfork-dev,libapr1-dev,libaprutil1-dev这三个包。

-------------------------------------------- 
 
Installation instructions for required software 
 
 * To install Apache 2 development headers: 
  Please run apt-get install apache2-prefork-dev as root. 
 
 * To install Apache Portable Runtime (APR) development headers: 
  Please run apt-get install libapr1-dev as root. 
 
 * To install Apache Portable Runtime Utility (APU) development headers: 
  Please run apt-get install libaprutil1-dev as root. 

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/7617d1d27e77d6b54e12c34125aa5ebd.html