字體:小 中 大 | |
|
|
2008/11/19 11:15:29瀏覽460|回應0|推薦0 | |
以root權限進行以下步驟, ======從這裡開始====== 1.安裝所需的debian套件 # aptitude install ruby ruby-dev rubygems build-essential libopenssl-ruby apache2-mpm-prefork apache2-prefork-dev 2.以rubygems安裝ruby套件 # gem install rake # gem install rails 3.建立程式link # ln -s /var/lib/gems/1.8/bin/rake /usr/local/bin/rake # ln -s /var/lib/gems/1.8/bin/rails /usr/local/bin/rails 4.建立rails應用程式 # cd /var/www # rails test_ap 5.安裝Phusion Passenger # gem install passenger 6.安裝apache2的passenger模組 # cd /var/lib/gems/1.8/gems/passenger-2.0.3/bin 此目錄下的檔案若未標示成可執行,先變更檔案屬性 # chmod +x passenger-* # ./passenger-install-apache2-module 7.建立模組的定義檔案 # vim /etc/apache2/mods-available/passenger.load 輸入以下內容, LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-2.0.3/ext/apache2/mod_passenger.so 8.載入passenger模組 # a2enmod passenger 若無法執行a2enmod,可自行建立link # ln -s /etc/apache2/mods-available/passenger.load /etc/apache2/mods-enabled/passenger.load 9.編寫apache2的設定檔 # vim /etc/apache2/sites-available/test_ap 輸入以下內容, PassengerRoot /var/lib/gems/1.8/gems/passenger-2.0.3 PassengerRuby /usr/bin/ruby1.8 ServerName www.yourhost.com DocumentRoot /somewhere/public 10.變更預設web server # cd /etc/apache2/sites-enabled # rm 000-default # ln -s /etc/apache2/sites-available/test_ap 001-test_ap 11.重新啟動apache2 # /etc/init.d/apache2 restart ======到這裡結束====== 註1. 如果不能正常安裝的話,請個別下載所需套件來安裝, Rake http://rubyforge.org/projects/rake/ Active Support http://rubyforge.org/projects/activesupport/ ActiveRecord http://rubyforge.org/projects/activerecord/ Action Pack http://rubyforge.org/projects/actionpack/ Action Mailer http://rubyforge.org/projects/actionmailer/ Active Resource http://rubyforge.org/projects/activeresource/ Rails http://rubyforge.org/projects/rails/ fastthread http://rubyforge.org/projects/mongrel/ Rack http://rubyforge.org/projects/rack/ Phusion Passenger http://rubyforge.org/projects/passenger/ 註2. Linux和Apache2的設定方式非常地多樣化,本文提供的方式並不是絕對! |
|
( 知識學習|其他 ) |