英文文档: How to: Ruby on Rails + Ubuntu + Apache with Passenger
安装ruby可以使用rvm进行管理:
curl -sSL https://get.rvm.io | bash -s stable
rvm install 1.9.3
apt-get 安装apache mysql
apt-get install apache2 apache2-mpm-prefork apache2-prefork-dev mysql-server mysql-client libmysql-ruby libmysqlclient15-dev
gem 安装rails mysql passenger
gem install passenger mysql2 rails
配置
passenger-install-apache2-module
将下面的配置写到/etc/apache2/apache2.conf
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2
PassengerRuby /usr/bin/ruby1.8
执行a2enmod rewrite
创建rails工程
rails new [project name] -d mysql
创建VirtualHost文件
a2ensite [VirtualHost].conf
最后:
service apache2 restart
网友评论