2008年10月17日 星期五

passenger, mod_rails

http://www.modrails.com/install.html
http://ihower.idv.tw/blog/archives/1741
http://nubyonrails.com/articles/ask-your-doctor-about-mod_rails
http://duckpunching.com/passenger-mod_rails-for-development-now-with-debugger
http://www.modrails.com/documentation/Users%20guide.html
  1. Open a terminal, and type:
    gem install passenger
  2. Type:
    passenger-install-apache2-module
  3. /etc/apache2/apache2.conf
    LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3/ext/apache2/mod_passenger.so
    PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3
    PassengerRuby /usr/bin/ruby1.8

    RailsEnv development <= development mode, default is production mode
  4. /etc/apache2/sites-available/iwakela
  5. <virtualhost>
    ServerAdmin iwakela@localhost

    ServerName iwakela.local
    DocumentRoot /home/lake/rails_app/iwakela/public
    </virtualhost>
  6. sudo ln -s /etc/apache2/sites-available/iwakela /etc/apache2/sites-enabled/001-iwakela
  7. /etc/init.d/apache2 restart/start/stop
  8. /etc/hosts
  9. 127.0.1.1 iwakela.local

    enable debugger

  10. # ... bottom of your development.rb

    if File.exists?(File.join(RAILS_ROOT,'tmp', 'debug.txt'))
    require 'ruby-debug'
    Debugger.wait_connection = true
    Debugger.start_remote
    File.delete(File.join(RAILS_ROOT,'tmp', 'debug.txt'))
    end


  11. # add this rake file to your lib/tasks folder
    # File: restart.rake
    task :restart do
    system("touch tmp/restart.txt")
    system("touch tmp/debug.txt") if ENV["DEBUG"] == 'true'
    end


  12. rake restart DEBUG=true


  13. rdebug -c


沒有留言: