{"id":80,"date":"2011-07-26T21:53:56","date_gmt":"2011-07-27T02:53:56","guid":{"rendered":"http:\/\/blogs.wp.stage.cpanel.net\/2011\/07\/installing_mod_rails_and_rails_309_on_a_cpanel_machine\/"},"modified":"2011-07-26T21:53:56","modified_gmt":"2011-07-27T02:53:56","slug":"installing_mod_rails_and_rails_309_on_a_cpanel_machine","status":"publish","type":"post","link":"https:\/\/devel.www.cpanel.net\/blog\/products\/installing_mod_rails_and_rails_309_on_a_cpanel_machine\/","title":{"rendered":"Installing mod_rails and Rails 3.0.9 on a cPanel machine"},"content":{"rendered":"

While Rails 3 and mod_rails (aka Phusion Passenger) are not yet supported with cPanel, it is possible in 30 minutes or less to install Rails 3.0.9, install mod_rails and get a working application using mod_rails in place of mongrel.<\/p>\n

Of note, the steps I am about to provide are to be used at your own risk. cPanel > Ruby on Rails applications cannot and should not be used if you decide to follow this guide, since the current cPanel environment only supports Rails 2.3.12 rather than Rails 3.0.9. Support is being planned for Rails 3 and mod_rails in cPanel 11.34 (more details can be found at this location<\/a>).<\/p>\n

In root SSH to install the newest Rails version to replace Rails 2.3 ones, please run the following command:
\ngem install rails<\/code><\/p>\n

Next, install mod_rails with these commands:
\ngem install passenger
\npassenger-install-apache2-module<\/code><\/p>\n

After installation, edit \/usr\/local\/apache\/conf\/includes\/pre_main_global.conf to add the following lines:
\nLoadModule passenger_module \/usr\/lib\/ruby\/gems\/1.8\/gems\/passenger-3.0.8\/ext\/apache2\/mod_passenger.so
\nPassengerRoot \/usr\/lib\/ruby\/gems\/1.8\/gems\/passenger-3.0.8
\nPassengerRuby \/usr\/bin\/ruby<\/code><\/p>\n

Please change passenger-3.0.8 above to whatever version of passenger was installed when using “gem install passenger” command. To check, you can always run the following command:
\n# gem list --local | grep -i passenger
\npassenger (3.0.8)<\/code><\/p>\n

At that point, make a backup of httpd.conf file, distill the changes, rebuild Apache and restart Apache with these commands:
\ncp \/usr\/local\/apache\/conf\/httpd.conf \/usr\/local\/apache\/conf\/httpd.conf.bak-modrails
\n\/usr\/local\/cpanel\/bin\/apache_conf_distiller --update
\n\/scripts\/rebuildhttpdconf
\n\/etc\/init.d\/httpd restart<\/code><\/p>\n

To test a working application, a hello world application can be generated with the following steps:
\nrails new \/home\/username\/hello
\ncd \/home\/username\/hello
\nrails generate scaffold person name:string password:string email:string age:integer
\nrake db:create:all
\nrake db:migrate<\/code><\/p>\n

After this, create a symlink from \/home\/username\/hello\/public to \/home\/username\/public_html\/hello folder:
\nln -s \/home\/username\/hello\/public \/home\/username\/public_html\/hello<\/code><\/p>\n

Copy the development database in sqlite to the production one:
\ncd \/home\/username\/hello\/db
\ncp development.sqlite3 production.sqlite3<\/code><\/p>\n

Chown the application files to the user:
\nchown -R username:username \/home\/username\/hello<\/code><\/p>\n

Finally, create a rewrite for the subdomain folder and restart Apache again:
\necho \"RailsBaseURI \/hello\" >> \/home\/username\/hello\/public\/.htaccess
\n\/etc\/init.d\/httpd restart<\/code><\/p>\n

For an example application, one is available at the following location that was based on using the above guide: http:\/\/tristanwallace.com\/hello\/people<\/p>\n

Hopefully, these instructions will help anyone who does require mod_rails and Rails 3 to function in the meantime prior to cPanel 11.34<\/p>\n

– Posted by Tristan Wallace<\/p>\n","protected":false},"excerpt":{"rendered":"

While Rails 3 and mod_rails (aka Phusion Passenger) are not yet supported with cPanel, it is possible in 30 minutes or less to install Rails 3.0.9, install mod_rails and get a working application using mod_rails in place of mongrel.<\/p>\n","protected":false},"author":77,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[49],"tags":[437,441],"class_list":["post-80","post","type-post","status-publish","format-standard","hentry","category-products","tag-mod_rails","tag-rails-3-0-9"],"acf":[],"yoast_head":"\nInstalling mod_rails and Rails 3.0.9 on a cPanel machine | cPanel<\/title>\n <!-- Mirrored from cpanel.net/wp-json/wp/v2/posts/80/ by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 06 Sep 2024 09:53:59 GMT --> <meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=_-2085.html \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Installing mod_rails and Rails 3.0.9 on a cPanel machine | cPanel\" \/>\n<meta property=\"og:description\" content=\"While Rails 3 and mod_rails (aka Phusion Passenger) are not yet supported with cPanel, it is possible in 30 minutes or less to install Rails 3.0.9, install mod_rails and get a working application using mod_rails in place of mongrel.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/devel.www.cpanel.net\/blog\/products\/installing_mod_rails_and_rails_309_on_a_cpanel_machine\/\" \/>\n<meta property=\"og:site_name\" content=\"cPanel\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/cpanel\/\" \/>\n<meta property=\"article:published_time\" content=\"2011-07-27T02:53:56+00:00\" \/>\n<meta name=\"author\" content=\"cPanel Community\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@cPanel\" \/>\n<meta name=\"twitter:site\" content=\"@cPanel\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"cPanel Community\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/devel.www.cpanel.net\/blog\/products\/installing_mod_rails_and_rails_309_on_a_cpanel_machine\/\",\"url\":\"https:\/\/devel.www.cpanel.net\/blog\/products\/installing_mod_rails_and_rails_309_on_a_cpanel_machine\/\",\"name\":\"Installing mod_rails and Rails 3.0.9 on a cPanel machine | cPanel\",\"isPartOf\":{\"@id\":\"https:\/\/devel.www.cpanel.net\/#website\"},\"datePublished\":\"2011-07-27T02:53:56+00:00\",\"dateModified\":\"2011-07-27T02:53:56+00:00\",\"author\":{\"@id\":\"https:\/\/devel.www.cpanel.net\/#\/schema\/person\/8cf97408aad4fb70cf55d11a1d4f57f8\"},\"breadcrumb\":{\"@id\":\"https:\/\/devel.www.cpanel.net\/blog\/products\/installing_mod_rails_and_rails_309_on_a_cpanel_machine\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/devel.www.cpanel.net\/blog\/products\/installing_mod_rails_and_rails_309_on_a_cpanel_machine\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/devel.www.cpanel.net\/blog\/products\/installing_mod_rails_and_rails_309_on_a_cpanel_machine\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/devel.www.cpanel.net\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Installing mod_rails and Rails 3.0.9 on a cPanel machine\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/devel.www.cpanel.net\/#website\",\"url\":\"https:\/\/devel.www.cpanel.net\/\",\"name\":\"cPanel\",\"description\":\"Hosting Platform of Choices\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/devel.www.cpanel.net\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/devel.www.cpanel.net\/#\/schema\/person\/8cf97408aad4fb70cf55d11a1d4f57f8\",\"name\":\"cPanel Community\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/devel.www.cpanel.net\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e1949945083b5526bb95711bd3d616b3?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/e1949945083b5526bb95711bd3d616b3?s=96&d=mm&r=g\",\"caption\":\"cPanel Community\"},\"description\":\"The web hosting industry's most reliable management solution since 1997. With our first-class support and rich feature set, it's easy to see why our customers and partners make cPanel & WHM their hosting platform of choice. For more information, visit cPanel.net.\",\"sameAs\":[\"https:\/\/cpanel.net\"],\"url\":\"https:\/\/devel.www.cpanel.net\/blog\/author\/cpadmin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Installing mod_rails and Rails 3.0.9 on a cPanel machine | cPanel","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/devel.www.cpanel.net\/blog\/products\/installing_mod_rails_and_rails_309_on_a_cpanel_machine\/","og_locale":"en_US","og_type":"article","og_title":"Installing mod_rails and Rails 3.0.9 on a cPanel machine | cPanel","og_description":"While Rails 3 and mod_rails (aka Phusion Passenger) are not yet supported with cPanel, it is possible in 30 minutes or less to install Rails 3.0.9, install mod_rails and get a working application using mod_rails in place of mongrel.","og_url":"https:\/\/devel.www.cpanel.net\/blog\/products\/installing_mod_rails_and_rails_309_on_a_cpanel_machine\/","og_site_name":"cPanel","article_publisher":"https:\/\/www.facebook.com\/cpanel\/","article_published_time":"2011-07-27T02:53:56+00:00","author":"cPanel Community","twitter_card":"summary_large_image","twitter_creator":"@cPanel","twitter_site":"@cPanel","twitter_misc":{"Written by":"cPanel Community","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/devel.www.cpanel.net\/blog\/products\/installing_mod_rails_and_rails_309_on_a_cpanel_machine\/","url":"https:\/\/devel.www.cpanel.net\/blog\/products\/installing_mod_rails_and_rails_309_on_a_cpanel_machine\/","name":"Installing mod_rails and Rails 3.0.9 on a cPanel machine | cPanel","isPartOf":{"@id":"https:\/\/devel.www.cpanel.net\/#website"},"datePublished":"2011-07-27T02:53:56+00:00","dateModified":"2011-07-27T02:53:56+00:00","author":{"@id":"https:\/\/devel.www.cpanel.net\/#\/schema\/person\/8cf97408aad4fb70cf55d11a1d4f57f8"},"breadcrumb":{"@id":"https:\/\/devel.www.cpanel.net\/blog\/products\/installing_mod_rails_and_rails_309_on_a_cpanel_machine\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/devel.www.cpanel.net\/blog\/products\/installing_mod_rails_and_rails_309_on_a_cpanel_machine\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/devel.www.cpanel.net\/blog\/products\/installing_mod_rails_and_rails_309_on_a_cpanel_machine\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/devel.www.cpanel.net\/"},{"@type":"ListItem","position":2,"name":"Installing mod_rails and Rails 3.0.9 on a cPanel machine"}]},{"@type":"WebSite","@id":"https:\/\/devel.www.cpanel.net\/#website","url":"https:\/\/devel.www.cpanel.net\/","name":"cPanel","description":"Hosting Platform of Choices","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/devel.www.cpanel.net\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/devel.www.cpanel.net\/#\/schema\/person\/8cf97408aad4fb70cf55d11a1d4f57f8","name":"cPanel Community","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/devel.www.cpanel.net\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e1949945083b5526bb95711bd3d616b3?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e1949945083b5526bb95711bd3d616b3?s=96&d=mm&r=g","caption":"cPanel Community"},"description":"The web hosting industry's most reliable management solution since 1997. With our first-class support and rich feature set, it's easy to see why our customers and partners make cPanel & WHM their hosting platform of choice. For more information, visit cPanel.net.","sameAs":["https:\/\/cpanel.net"],"url":"https:\/\/devel.www.cpanel.net\/blog\/author\/cpadmin\/"}]}},"_links":{"self":[{"href":"https:\/\/devel.www.cpanel.net\/wp-json\/wp\/v2\/posts\/80"}],"collection":[{"href":"https:\/\/devel.www.cpanel.net\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devel.www.cpanel.net\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devel.www.cpanel.net\/wp-json\/wp\/v2\/users\/77"}],"replies":[{"embeddable":true,"href":"https:\/\/devel.www.cpanel.net\/wp-json\/wp\/v2\/comments?post=80"}],"version-history":[{"count":0,"href":"https:\/\/devel.www.cpanel.net\/wp-json\/wp\/v2\/posts\/80\/revisions"}],"wp:attachment":[{"href":"https:\/\/devel.www.cpanel.net\/wp-json\/wp\/v2\/media?parent=80"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devel.www.cpanel.net\/wp-json\/wp\/v2\/categories?post=80"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devel.www.cpanel.net\/wp-json\/wp\/v2\/tags?post=80"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}