<?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/"
		xmlns:xhtml="http://www.w3.org/1999/xhtml"
>

<channel>
	<title>tech-memo &#187; passenger</title>
	<atom:link href="http://tech.hapicky.com/archives/tag/passenger/feed" rel="self" type="application/rss+xml" />
	<link>http://tech.hapicky.com</link>
	<description>ソフトウェアエンジニアリングに関するメモ書き</description>
	<lastBuildDate>Tue, 02 Feb 2010 05:42:30 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://tech.hapicky.com/archives/tag/passenger/feed" />
		<item>
		<title>Passenger(mod_rails for Apache)を試す</title>
		<link>http://tech.hapicky.com/archives/19</link>
		<comments>http://tech.hapicky.com/archives/19#comments</comments>
		<pubDate>Mon, 14 Apr 2008 17:37:48 +0000</pubDate>
		<dc:creator>hapicky</dc:creator>
				<category><![CDATA[未分類]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[passenger]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://tech.hapicky.com/archives/19</guid>
		<description><![CDATA[Passenger(mod_rails for Apache)をインストールしてみました。 試した環境は MaxOSX Tiger Apache2.2(MacPortsでインストール済み) です。 apacheが複数インストールされている場合は対象のApache apxsを指定する必要があるようです。 > export APXS2=/opt/local/apache2/bin/apxs まずgemでインストールして、 > sudo gem install passenger -y mod_railsをインストール。 > sudo passenger-install-apache2-module ありゃ。 ### In ext/apache2: g++ -flat_namespace -bundle -undefined dynamic_lookup Utils.o Logging.o Configuration.o Hooks.o mod_passenger.o -fPIC -o mod_passenger.so -lstdc++ -lpthread ../boost/src/libboost_thread.a -L/opt/local/lib -lapr-1 /usr/bin/ld: flag: -undefined dynamic_lookup can't be used with MACOSX_DEPLOYMENT_TARGET [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.modrails.com/" target="_blank">Passenger(mod_rails for Apache)</a>をインストールしてみました。<br />
試した環境は</p>
<ul>
<li>MaxOSX Tiger</li>
<li>Apache2.2(MacPortsでインストール済み)</li>
</ul>
<p>です。</p>
<p>apacheが複数インストールされている場合は対象のApache apxsを指定する必要があるようです。</p>
<pre class="brush:bash">
> export APXS2=/opt/local/apache2/bin/apxs
</pre>
<p>まずgemでインストールして、</p>
<pre class="brush:bash">
> sudo gem install passenger -y
</pre>
<p>mod_railsをインストール。</p>
<pre class="brush:bash">
> sudo passenger-install-apache2-module
</pre>
<p>ありゃ。</p>
<pre class="brush:plain">
### In ext/apache2:
g++ -flat_namespace -bundle -undefined dynamic_lookup Utils.o Logging.o Configuration.o Hooks.o mod_passenger.o -fPIC -o mod_passenger.so   -lstdc++ -lpthread ../boost/src/libboost_thread.a -L/opt/local/lib -lapr-1
/usr/bin/ld: flag: -undefined dynamic_lookup can't be used with MACOSX_DEPLOYMENT_TARGET environment variable set to: 10.1
collect2: ld returned 1 exit status
rake aborted!
Command failed with status (1): [g++ -flat_namespace -bundle -undefined dyn...]
/opt/local/lib/ruby/gems/1.8/gems/passenger-1.0.1/rakefile:132
(See full trace by running task with --trace)
</pre>
<p>明らかに怪しいので MACOSX_DEPLOYMENT_TARGET を設定してリトライ。</p>
<pre class="brush:bash">
> export MACOSX_DEPLOYMENT_TARGET=10.4
> sudo passenger-install-apache2-module
</pre>
<p>とおった。</p>
<pre class="brush:plain">
The Apache 2 module was successfully installed.
</pre>
<p>以下のように表示されるので、httpd.confに設定を追加。</p>
<pre class="brush:plain">
Please edit your Apache configuration file, and add these lines:

LoadModule passenger_module /opt/local/lib/ruby/gems/1.8/gems/passenger-1.0.1/ext/apache2/mod_passenger.so
RailsSpawnServer /opt/local/lib/ruby/gems/1.8/gems/passenger-1.0.1/bin/passenger-spawn-server
RailsRuby /opt/local/bin/ruby
</pre>
<p>VirtualHostの設定でrailsアプリケーションの位置を指定。</p>
<pre class="brush:plain">
&lt;VirtualHost *:80&gt;
        ServerName test.hoge.com
        DocumentRoot /path/to/rails/public
&lt;/VirtualHost&gt;
</pre>
<p>apacheを再起動。</p>
<pre class="brush:bash">
> apachectl configtest
> sudo apachectl restart
</pre>
<p>無事動作しました。<br />
<a href="http://blog.masuidrive.jp/index.php/2008/04/14/mod_rails_uses_triple_memory_than_mongrel/" target="_blank">mod_rails(passenger)はmogrelの3倍メモリを食う？</a> らしいですが、どちらを使おうか。</p>
<p>ちなみにapacheを再起動することなく、railsアプリケーションを再読み込みしたい場合はrailsアプリのtmpディレクトリに restart.txt を置けば（または更新すれば）よいとのこと。ふむ。<br />
<a href="http://www.modrails.com/documentation/Users%20guide.html#_redeploying_restarting_the_ruby_on_rails_application" target="_blank">Passenger users guide</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tech.hapicky.com/archives/19/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://tech.hapicky.com/archives/19" />
	</item>
	</channel>
</rss>

