在FreeBSD上建立基本的Rails環境

需要從ports裝:
apache22
ruby18 (/usr/ports/lang/ruby18)
rubygem (/usr/ports/devel/ruby-gems)

用gem裝:

gem i rails
gem i passenger

裝完passenger要:
/usr/local/bin/passenger-install-apache2-module

然後會有超友善的引導程式帶你做事

編輯Apache configuration file(httpd.conf),加入下面幾行(確切的內容上面那隻導引程式跑完會告訴你,因版本而異)
LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.4/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.4
PassengerRuby /usr/local/bin/ruby18

再來vhost root設好(DocumentRoot /somewhere/public # <– be sure to point to ‘public’!)
(我是會在vhost下設定RailsSpawnMethod跟RailsEnv development方便改code測試,這樣似乎就不會有cache)
檔案所有人和權限注意一下對httpd的權限
如果public不是DocumentRoot,要記得再加上RailBaseURI
這樣應該就沒問題了

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 變更 )

Twitter picture

You are commenting using your Twitter account. Log Out / 變更 )

Facebook照片

You are commenting using your Facebook account. Log Out / 變更 )

Google+ photo

You are commenting using your Google+ account. Log Out / 變更 )

連結到 %s

%d 位部落客按了讚: