代碼:
ruby script/server webrick -e production
默認(rèn)的管理員用戶名和密碼都是admin,進(jìn)入系統(tǒng)后就可以開始熟悉下了?梢詾槊總人定義語言環(huán)境。下圖是管理頁面。
在apache上部署
其自帶的webrick可能不能滿足使用需求,那么就把它配置到apache上。
apache運行ROR有多種方式,這里使用passenger。
代碼:
apt-get install build-essential apt-get install apache2-prefork-dev libaprutil1-dev libapr1-dev ruby1.8-dev
然后安裝 passenger
代碼:
gem install passenger passenger-install-apache2-module
如果報passenger-install-apache2-module這條命令找不到的話,那么通過下面的命令查看執(zhí)行路徑:
代碼:
gem environment
代碼:
RubyGems Environment: - RUBYGEMS VERSION: 1.3.5 - RUBY VERSION: 1.8.7 (2010-01-10 patchlevel 249) [i486-linux] - INSTALLATION DIRECTORY: /var/lib/gems/1.8 - RUBY EXECUTABLE: /usr/bin/ruby1.8 - EXECUTABLE DIRECTORY: /var/lib/gems/1.8/bin - RUBYGEMS PLATFORMS: - ruby - x86-linux - GEM PATHS: - /var/lib/gems/1.8 - /root/.gem/ruby/1.8 - GEM CONFIGURATION: - :update_sources => true - :verbose => true - :benchmark => false - :backtrace => false - :bulk_threshold => 1000 - REMOTE SOURCES: - http://gems.rubyforge.org/
其中,EXECUTABLE DIRECTORY就是命令的全路徑,所以對于我例子里的情況執(zhí)行
代碼:
/var/lib/gems/1.8/bin/passenger-install-apache2-module
根據(jù)提示安裝和部署。
passenger會在本機編譯并成為apache的一個模塊。安裝過程中會遇到下面的提示信息(根據(jù)版本的不同,信息也會稍有變化):
代碼:
Welcome to the Phusion Passenger Apache 2 module installer, v2.2.13. 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.
代碼:
The Apache 2 module was successfully installed. Please edit your Apache configuration file, and add these lines: LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-2.2.13/ext/apache2/mod_passenger.so PassengerRoot /var/lib/gems/1.8/gems/passenger-2.2.13 PassengerRuby /usr/bin/ruby1.8 After you restart Apache, you are ready to deploy any number of Ruby on Rails applications on Apache, without any further Ruby on Rails-specific configuration!
代碼:
Deploying a Ruby on Rails application: an example Suppose you have a Rails application in /somewhere. Add a virtual host to your Apache configuration file and set its DocumentRoot to /somewhere/public: <VirtualHost *:80> ServerName www.yourhost.com DocumentRoot /somewhere/public # <-- be sure to point to 'public'! <Directory /somewhere/public> AllowOverride all # <-- relax Apache security settings Options -MultiViews # <-- MultiViews must be turned off </Directory> </VirtualHost> And that's it! You may also want to check the Users Guide for security and optimization tips, troubleshooting and other useful information: /var/lib/gems/1.8/gems/passenger-2.2.13/doc/Users guide Apache.html Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) :-) http://www.modrails.com/ Phusion Passenger is a trademark of Hongli Lai & Ninh Bui
根據(jù)提示信息部署,我這里的步驟稍有不同。
出處:藍(lán)色理想
責(zé)任編輯:bluehearts
上一頁 Redmine+Apache+SVN+Postfix配置 [2] 下一頁 Redmine+Apache+SVN+Postfix配置 [4]
◎進(jìn)入論壇網(wǎng)絡(luò)編程版塊參加討論
|