{"id":1741,"date":"2008-05-21T01:57:13","date_gmt":"2008-05-20T17:57:13","guid":{"rendered":"http:\/\/ihower.idv.tw\/blog\/?p=1741"},"modified":"2016-10-15T18:47:22","modified_gmt":"2016-10-15T10:47:22","slug":"passenger-mod_rails-development-environment","status":"publish","type":"post","link":"https:\/\/ihower.tw\/blog\/1741-passenger-mod_rails-development-environment","title":{"rendered":"\u4f7f\u7528 Passenger (a.k.a mod_rails) \u7576\u505a\u958b\u767c\u74b0\u5883"},"content":{"rendered":"<p>Update(2008\/6\/25): \u63d0\u6607 MacOS \u958b\u767c\u723d\u5ea6\u8acb\u88dd Pane <a href=\"http:\/\/www.fngtps.com\/2008\/06\/putting-the-pane-back-into-deployment\">Putting the pane back into deployment<\/a><\/p>\n<p>Update(2008\/5\/24): \u66f4\u591a\u53c3\u8003\u9023\u7d50<a href=\"http:\/\/www.rubyinside.com\/28_mod_rails_and_passenger_resources-899.html\"> 28 mod_rails \/ Passenger Resources To Help You Deploy Rails Applications Faster<\/a><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1744\" data-permalink=\"https:\/\/ihower.tw\/blog\/1741-passenger-mod_rails-development-environment\/passenger\" data-orig-file=\"https:\/\/ihower.tw\/blog\/wp-content\/uploads\/2008\/05\/passenger.jpg\" data-orig-size=\"206,69\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"passenger\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/ihower.tw\/blog\/wp-content\/uploads\/2008\/05\/passenger.jpg\" data-large-file=\"https:\/\/ihower.tw\/blog\/wp-content\/uploads\/2008\/05\/passenger.jpg\" src=\"\/blog\/wp-content\/uploads\/2008\/05\/passenger.jpg\" alt=\"\" title=\"passenger\" width=\"206\" height=\"69\" class=\"alignnone size-medium wp-image-1744\" \/><\/p>\n<p><a href=\"http:\/\/modrails.com\/\">mod_rails<\/a>(\u5b78\u540d\u662f Passenger) \u51fa\u4f86\u4e00\u6bb5\u6642\u9593\u4e86\uff0c\u9678\u7e8c\u958b\u59cb\u6709\u4e9b\u4f7f\u7528\u7d93\u9a57\u5206\u4eab\u51fa\u4f86\uff0c\u5728 production \u4e0a\u9084\u883b\u9069\u5408RAM\u6709\u9650\u7684 VPS \u74b0\u5883\uff0c\u800c\u9019\u7bc7 <a href=\"http:\/\/nubyonrails.com\/articles\/ask-your-doctor-about-mod_rails\">Ask Your Doctor About mod_rails<\/a>\u5247\u4ecb\u7d39 mod_rails \u4e5f\u5341\u5206\u9069\u5408\u62ff\u4f86\u7576\u505a development \u74b0\u5883\uff0c\u4e5f\u8b93\u6211\u5341\u5206\u5fc3\u52d5\uff1a<\/p>\n<ol>\n<li>\u53ad\u5026\u6bcf\u6b21\u90fd\u5f97 mongral_rails start \u6216 script\/server\uff1f\u800c\u4e14\u9084\u8981\u4f54 terminal tabs\u3002\u50cf\u6211\u624b\u4e0a\u540c\u6642\u9593\u597d\u5e7e\u500b\u6848\u5b50(?!)\uff0c\u5e38\u5e38\u8981\u5207\u4f86\u5207\u53bb\u9084\u633a\u9ebb\u7169\u7684\u3002\u6709\u4e86 mod_rails \u8a2d\u5b9a\u597d\u4e4b\u5f8c\uff0c\u6bcf\u500b\u7db2\u7ad9\u90fd\u96a8\u6642 ready \u53ef\u4ee5\u7528\u3002(\u6015 memory \u6d6a\u8cbb?mod_rails \u53ef\u4ee5\u7d93\u7531\u8a2d\u5b9a <a href=\"http:\/\/www.modrails.com\/documentation\/Users%20guide.html#_configuring_passenger\">RailsPoolIdleTime, RailsMaxPoolSize<\/a> \u4f86\u9650\u5236 process \u5b58\u5728\u7684\u6642\u9593\u8ddf\u6578\u91cf)<\/li>\n<li>\u55ae\u4e00 mongrel process \u6c92\u8fa6\u6cd5\u5e73\u884c\u8655\u7406 requests\uff0c\u7576\u7db2\u7ad9\u5716\u7247\u6771\u897f\u6bd4\u8f03\u591a\u7684\u6642\u5019\uff0c\u901f\u5ea6\u5c31\u6162\u4e86\u3002\u800c mod_rails \u5728\u6709\u984d\u5916\u7684 request \u9700\u6c42\u6642\uff0c\u6703 new process \u4f86\u652f\u63f4\u3002<\/li>\n<li>\u6709 Apache \u5c31\u53ef\u4ee5\u8a2d\u5b9a SSL\uff0c\u53ea\u7528 mongrel \u6c92\u8fa6\u6cd5\u6e2c\u8a66 HTTPS \u9023\u7dda\u3002<\/li>\n<\/ol>\n<p>\u5fc3\u52d5\u4e86\u7576\u7136\u5f97\u99ac\u4e0a\u884c\u52d5\uff0c\u53c3\u8003\u4e86\u9019\u7bc7 <a href=\"http:\/\/www.fngtps.com\/2008\/04\/using-passenger-on-osx-for-rails-development\">Using Passenger on OSX for Rails development<\/a>\uff0c\u6211\u5f88\u9806\u5229\u5730\u5728\u6211\u7684 Mac Leopard \u4e0a\u67b6\u4e86\u8d77\u4f86\uff1a<\/p>\n<p>1.\u5b89\u88dd Passenger\uff1a<br \/>\n<code><br \/>\ngem install passenger<br \/>\npassenger-install-apache2-module<br \/>\n<\/code><\/p>\n<p>2.\u8a2d\u5b9a Apache\uff0c\u7de8\u8f2f \/etc\/apache2\/httpd.conf \u6216 \/etc\/apache2\/users\/ihower.conf\uff0c\u4ee5\u4e0b\u662f\u4e00\u500b\u7bc4\u4f8b (\u524d\u4e09\u884c\u8acb\u53c3\u8003\u57f7\u884c passenger-install-apache2-module \u6642\u986f\u793a\u7684\u8a0a\u606f) \uff1a<\/p>\n<p><code><br \/>\nLoadModule passenger_module \/opt\/local\/lib\/ruby\/gems\/1.8\/gems\/passenger-2.0.1\/ext\/apache2\/mod_passenger.so<br \/>\nPassengerRoot \/opt\/local\/lib\/ruby\/gems\/1.8\/gems\/passenger-2.0.1<br \/>\nPassengerRuby \/opt\/local\/bin\/ruby<br \/>\nPassengerMaxPoolSize 3<br \/>\nPassengerPoolIdleTime 300<br \/>\nRailsEnv development<\/p>\n<p>&lt;Directory \"\/Users\/ihower\/RailsCode\"><br \/>\n    Order allow,deny<br \/>\n    Allow from all<br \/>\n&lt;\/Directory><\/p>\n<p>NameVirtualHost *:80<\/p>\n<p>&lt;VirtualHost *:80><br \/>\nDocumentRoot \"\/Users\/ihower\/RailsCode\/project1\/public\"<br \/>\nServerName project1.local<br \/>\n&lt;\/VirtualHost><\/p>\n<p>&lt;VirtualHost *:80><br \/>\nDocumentRoot \"\/Users\/ihower\/RailsCode\/project2\/public\"<br \/>\nServerName project2.local<br \/>\n&lt;\/VirtualHost><\/p>\n<p><\/code><\/p>\n<ol>\n<li>\u8a2d\u5b9a \/etc\/hosts \u6307\u5b9a\u672c\u5730\u7aef domain\uff1a<br \/>\n<code><br \/>\n127.0.0.1 project1.local<br \/>\n127.0.0.1 project2.local<br \/>\n<\/code><\/li>\n<\/ol>\n<p>4.\u6253\u958b Mac \u4e0a\u7684 System Preferences \u2794 Sharing \u2794 Web Sharing\uff0c\u555f\u52d5 Apache\u3002<br \/>\n5.\u6253\u958b\u4f60\u7684\u700f\u89bd\u5668\uff0c\u8f38\u5165 project1.local, project2.local \u9806\u5229\u7684\u8a71\u5c31\u53ef\u4ee5\u770b\u5230\u5566\u3002<\/p>\n<p>\u554f: \u4fee\u6539\u4e86 \/vendor\/ \u4e0b\u9762\u7684\u6771\u897f\u8981\u91cd\u65b0\u8f09\u5165\u600e\u9ebc\u8fa6?<br \/>\n\u7b54\uff1amod_rails \u7684\u7528\u6cd5\u633a\u6709\u8da3\u7684\uff0c\u8acb\u57f7\u884c\uff1a<br \/>\n<code><br \/>\ntouch tmp\/restart.txt<br \/>\n<\/code><\/p>\n<p>\u5982\u679c\u8981\u4e00\u76f4\u4fee\u6539 vendor \u7684\u8a71(\u5728\u5bebplugin\u55ce?)\uff0c\u53ef\u4ee5\u4e0b\u8f09 <a href=\"http:\/\/nubyonrails.com\/articles\/automation-with-rstakeout\">Automation with RStakeout<\/a>\uff0c\u7136\u5f8c\u57f7\u884c\uff1a<br \/>\n<code><br \/>\nruby rstakeout.rb \"touch tmp\/restart.txt\" \"vendor\/**\/*\"<br \/>\n<\/code><br \/>\n\u9019\u6a23\u4e00\u6709\u66f4\u52d5\u5c31\u6703reload\u4e86\uff0ccool\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Update(2008\/6\/25): \u63d0\u6607 MacOS \u958b\u767c\u723d\u5ea6\u8acb\u88dd Pane Putting the pan &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/ihower.tw\/blog\/1741-passenger-mod_rails-development-environment\" class=\"more-link\">\u95b1\u8b80\u5168\u6587<span class=\"screen-reader-text\">\u3008\u4f7f\u7528 Passenger (a.k.a mod_rails) \u7576\u505a\u958b\u767c\u74b0\u5883\u3009<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[46,53],"tags":[],"class_list":["post-1741","post","type-post","status-publish","format-standard","hentry","category-mac","category-rails","entry"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1q6tG-s5","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/posts\/1741","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/comments?post=1741"}],"version-history":[{"count":3,"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/posts\/1741\/revisions"}],"predecessor-version":[{"id":8597,"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/posts\/1741\/revisions\/8597"}],"wp:attachment":[{"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/media?parent=1741"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/categories?post=1741"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ihower.tw\/blog\/wp-json\/wp\/v2\/tags?post=1741"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}