<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>tylerdave.com &#187; cPanel</title>
	<atom:link href="http://www.tylerdave.com/tag/cpanel/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tylerdave.com</link>
	<description></description>
	<lastBuildDate>Sun, 31 Jan 2010 04:42:30 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Configuring Passenger (mod_rails) on cPanel Systems</title>
		<link>http://www.tylerdave.com/2009/10/12/configuring-passenger-on-cpanel-systems/</link>
		<comments>http://www.tylerdave.com/2009/10/12/configuring-passenger-on-cpanel-systems/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 13:57:23 +0000</pubDate>
		<dc:creator>tylerdave (Dave Forgac)</dc:creator>
				<category><![CDATA[System Admin]]></category>
		<category><![CDATA[cPanel]]></category>
		<category><![CDATA[Passenger]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.tylerdave.com/?p=43</guid>
		<description><![CDATA[cPanel has built-in support for Rails apps using Mongrel but this involves multiple servers and port forwarding and only allows one applicaiton per cPanel user.  Phusion Passenger is an Apache (and Nginx) module that allows Rails applications to be run directly through the web server without further configuration.  Normal installation of Phusion Passenger [...]]]></description>
			<content:encoded><![CDATA[<p>cPanel has built-in support for Rails apps using Mongrel but this involves multiple servers and port forwarding and only allows one applicaiton per cPanel user.  Phusion Passenger is an Apache (and Nginx) module that allows Rails applications to be run directly through the web server without further configuration.  Normal installation of Phusion Passenger is very straight-forward but on cPanel servers, it must be installed in a cPanel-friendly way.</p>
<p><em>All of the following commands need to be run as root or with the use of sudo:</em></p>
<p>First, make sure Ruby is installed:</p>
<pre class="brush: plain; light: true;">root@host:[~]$ /scripts/installruby</pre>
<p>Next, install Passenger:</p>
<pre class="brush: plain; light: true;">root@host:[~]$ gem install passenger</pre>
<p>Then set the paths to Apache and the Apache dev headers and run the installer:</p>
<pre class="brush: plain; light: true;">root@host:[~]$ APXS2=/usr/local/apache/bin/apxs PATH=$PATH:/usr/local/apache/bin passenger-install-apache2-module
Welcome to the Phusion Passenger Apache 2 module installer, v2.2.5.

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.

Press Enter to continue, or Ctrl-C to abort.</pre>
<p>Hit enter and the installer will compile the Apache 2 module.  If this is successful you will get a message with directions for modifying the Apache conf:</p>
<pre class="brush: plain; light: true;">The Apache 2 module was successfully installed.

Please edit your Apache configuration file, and add these lines:

LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.5/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.5
PassengerRuby /usr/bin/ruby

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!

Press ENTER to continue.</pre>
<p>Copy the configuration directives and place them in <code>/usr/local/apache/conf/includes/pre_main_global.conf</code>. <em>Do not directly edit the httpd.conf!</em></p>
<p>These are the lines that should be added (with server-specific version numbers):</p>
<pre class="brush: plain; light: true;">LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.5/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.5
PassengerRuby /usr/bin/ruby</pre>
<p>Add the following to the httpd.conf (<a href="http://www.modrails.com/documentation/Users%20guide%20Apache.html#_compatibility_options Compatibility options">passenger docs</a>):</p>
<pre class="brush: plain; light: true;">PassengerResolveSymlinksInDocumentRoot on</pre>
<p>Run the httpd.conf config distiller to save these changes:</p>
<pre class="brush: plain; light: true;">root@host:[~]$ /usr/local/cpanel/bin/apache_conf_distiller --update
Distilled successfully</pre>
<p>Then rebuild the <code>httpd.conf</code> using the cPanel rebuild script. Stop and correct any errors before restarting Apache:</p>
<pre class="brush: plain; light: true;">root@host:[~]$ /scripts/rebuildhttpdconf
Built /usr/local/apache/conf/httpd.conf OK</pre>
<p>Restart Apache and verify Passenger is installed by running this command:</p>
<pre class="brush: plain; light: true;">root@host:[~]$ apachectl -t -D DUMP_MODULES</pre>
<p>Check for &#8216;passenger_module (shared)&#8217;.</p>
<p>By default, <code>RailsAutoDetect</code> is on so it will detect a directory that is a Rails application.  If this is off, you will need to add a custom vhost configuration to let Apache know to load Passenger for a particular site.  To do this add the following to the site&#8217;s vhost container:</p>
<pre class="brush: plain; light: true;">RailsBaseURI /</pre>
<p>(or whatever URI is the base of the application)</p>
<p>Directions for adding custom directives to a vhost in cPanel: <a href="http://www.cpanel.net/documentation/easyapache/customdirectives.html#vhost">Add Custom Apache Directives to a vhost in cPanel</a></p>
<p>If the Rails application will be the root of the site, you will need to create a symlink from the Rails application&#8217;s <code>public</code> directory to <code>/home/[username]/public_html</code>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tylerdave.com/2009/10/12/configuring-passenger-on-cpanel-systems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
