Linux Deploy Rails3 with Ruby1.9.2 (4) Configure the rails in Apache2

sponsored links
Linux Deploy Rails3 with Ruby1.9.2 (4) Configure the rails in Apache2

Change the configuration of apache2
> Vi httpd.conf
LoadModule passenger_module / home/luohua/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9/gems/passenger-3.0.8/ext/apache2/mod_passenger.so
PassengerRoot / home/luohua/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9/gems/passenger-3.0.8
PassengerRuby / home/luohua/.rvm/rubies/ruby-1.9.2-p290

try to restart the apache server
> Bin / apachel restart

error messages:
httpd: Syntax error on line 423 of / opt / tools / httpd / conf / httpd.conf: API module structure 'passenger_module' in file / home/luohua/.rvm/rubies/ruby-1.9.2-p290/lib/ruby / gems/1.9/gems/passenger-3.0.8/ext/apache2/mod_passenger.so is garbled - expected signature 41503232 but saw 41503230 - perhaps this is not an Apache module DSO, or was compiled for a different Apache version?

solutions:
That is because I have 2 version of apache2 on my server. I will use the one who compiled passenger.
The compile passenger information:
* Apache 2 ... found at / usr / bin / httpd
* Apache 2 development headers ... found at / usr / sbin / apxs
* Apache Portable Runtime (APR) development headers ... found at / usr / bin / apr-config
* Apache Portable Runtime Utility (APU) development headers ... found at / usr / bin / apu-config

> Sudo mv / usr / sbin / httpd / usr / sbin / httpd.bak
> Sudo ln-s / opt / tools / httpd / bin / httpd / usr / bin / httpd
> Sudo mv / usr / sbin / apxs / usr / sbin / apxs.bak
> Sudo ln-s / opt / tools / httpd / bin / apxs / usr / sbin / apxs

find the version of apache
> Bin / apachectl-V | grep SERVER_CONFIG_FILE

located the APXS2
> Export APXS2 = / opt / tools / httpd / bin / apxs

try to restart the apache again
> Bin / apachel restart

error message:
[Wed Aug 31 14:47:23 2011] [notice] SIGHUP received. Attempting to restart
*** Passenger ERROR (ext / common / ApplicationPool / .. / SpawnManager.h: 220):
Could not start the spawn server: / home/luohua/.rvm/rubies/ruby-1.9.2-p290: Permission denied (13)
[Pid = 14425 thr = 3086257024 file = ext/apache2/HelperAgent.cpp: 354 time = 2011-08-31 14:47:23.906]: Could not start the spawn server: write () failed: Broken pipe (32)
in 'Passenger:: SpawnManager:: SpawnManager (const std:: string &, const boost:: shared_ptr <Passenger::ServerInstanceDir::Generation> &, const Passenger:: AccountsDatabasePtr &, const std:: string &, const Passenger:: AnalyticsLoggerPtr &, int, const std:: string &) '(SpawnManager.h: 540)
in 'Passenger:: ApplicationPool:: Pool:: Pool (const std:: string &, const boost:: shared_ptr <Passenger::ServerInstanceDir::Generation> &, const Passenger:: AccountsDatabasePtr &, const std:: string &, const Passenger: : AnalyticsLoggerPtr &, int, const std:: string &) '(Pool.h: 1078)
in 'Server:: Server (Passenger:: FileDescriptor, pid_t, const std:: string &, bool, const std:: string &, const std:: string &, const std:: string &, const std:: string &, unsigned int, unsigned int, unsigned int, unsigned int, const Passenger:: VariantMap &) '(HelperAgent.cpp: 241)
in 'int main (int, char **)' (HelperAgent.cpp: 344)
[Wed Aug 31 14:47:23 2011] [error] *** Passenger could not be initialized because of this error: Unable to start the Phusion Passenger watchdog because it encountered the following error during startup: Unable to start the Phusion Passenger helper agent: it seems to have crashed during startup for an unknown reason, with exit code 1
[Wed Aug 31 14:47:23 2011] [notice] Apache/2.2.19 (Unix) Phusion_Passenger/3.0.8 configured - resuming normal operations

solutions:
> Sudo chmod a + x-R / home/luohua/.rvm/rubies/ruby-1.9.2-p290
or
> Sudo chmod 777-R / home/luohua/.rvm/rubies/ruby-1.9.2-p290

add this to my httpd.conf
PassengerRuby / usr / bin / ruby
PassengerDefaultUser root

link the ruby ​​to / usr / bin
> Sudo ln-s ~ / .rvm/rubies/ruby-1.9.2-p290/bin/ruby / usr / bin / ruby

Add one more Virtual host and visit our rails application
<VirtualHost *:80>
ServerName www.sillycat.com
DocumentRoot / opt / work / projectname / public
<Directory /opt/work/projectname/public>
Allow from all
Options-MultiViews
</ Directory>
</ VirtualHost>

I comments the following lines in httpd.conf:
# <Directory />
# Options FollowSymLinks
# AllowOverride None
# Order deny, allow
# Deny from all
# </ Directory>

After all these done, I can visit http://www.sillycat.com and get the pages.

That is not good way for rails, because I have some other applications on apache, and I do not want this application take the ROOT
content path.

So I will make all the static things in htdoc directory / opt / tools / httpd / htdocs
<VirtualHost *:80>
ServerName ud1129.chinaw3.com
DocumentRoot / opt / tools / httpd / htdocs
<Directory /opt/tools/httpd/htdocs>
Allow from all
</ Directory>
</ VirtualHost>

link my project to the htdocs directory
> Sudo ln-s / opt / work / projectname / public / opt / tools / httpd / htdocs / projectname

<VirtualHost *:80>
ServerName ud1129.chinaw3.com
DocumentRoot / opt / tools / httpd / htdocs
<Directory /opt/tools/httpd/htdocs>
Allow from all
</ Directory>

RailsBaseURI / projectname
<Directory /opt/tools/httpd/htdocs/projectname>
Options-MultiViews
</ Directory>
</ VirtualHost>

Tips: In this way, wa can make multi rails applications.
<VirtualHost *:80>
....
RailsBaseURI / app1
RailsBaseURI / app2
RailsBaseURI / app3
</ VirtualHost>

copy all the static things to htdocs / asset directory
> Sudo cp / opt / work / projectname / app / assets / images / opt / tools / httpd / htdocs / assets
> Sudo cp / opt / work / projectname / app / assets / javascripts / opt / tools / httpd / htdocs / assets
> Sudo cp / opt / work / projectname / app / assets / stylesheets / opt / tools / httpd / htdocs / assets

Ok, done, visit http://www.sillycat.com/projectname

references:
http://serdaryildirim.net/ruby-on-rails/installing-passenger.html
http://stackoverflow.com/questions/4946426/getting-rails-3-and-passenger-to-work-on-centos-5-4-apache-error
http://www.modrails.com/documentation/Users% 20guide% 20Apache.html
  • del.icio.us
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

Related Posts of Linux Deploy Rails3 with Ruby1.9.2 (4) Configure the rails in Apache2

  • flash chart summary

    pen Flash Chart is an open source Flash chart drawing tool, offers a variety of programming interfaces, including PHP, Ruby, Perl, Python, Java,. Net, AS, JS, etc. to generate a variety of data interfaces, and then Flash to display the function is to ...

  • Rails2.0.2 change the default DB adpter

    In Rails2.0.2 rails demo ... ... MissingSourceFile in SayController # hello no such file to load - sqlite3 RAILS_ROOT: / home / kenb / rails-projects / demo ... ... Checked config / database.yml, adpter default is set become the sqlite3. Check the ra ...

  • RSpec troubleshooting

    1.uninitialized constant Dependencies Conditions: In windows under way to install the RSpec gem and rspec-rails. However, in ruby script / spec_server to do the test under the spec your_spec.rb-X will appear uninitialized constant Dependencies (NameE ...

  • Alternative to Java with Ruby to do unit testing interface rest!

    Ruby is long overdue to replace java more flexible and make some necessary changes in a matter of, if not deep-rooted culture of the company's java, I think. . . . . . The following are my Writing for the Rest of the interface used to make the test su

  • Answer: After 2.2 upgrade mysql question-driven

    windows installed after the mysql gem error, error is approximately: ArgumentError (NULL pointer given): (eval): 3: in `each_hash ' (eval): 3: in `all_hashes' This is feeling under the windows of the question if the mysql gem version libmysql ...

  • JPA data source data source to configure Tomcat conversion essay questions

    To the JPA in the use of the development process, sometimes used in the data source conversion problem, The following methods are only my personal experience of a situation and its solutions, if different, please everyone posted for your reference encount

  • Hibernate II Study Notes

    11. Many-to-many Of many that can be converted to two one-to-many <set name="students" table="teacher_student"> <key column="techer_id"/> <many-to-many column="student_id"/> </set> many-to-many data only from one end of the mainten

  • Workspace run under different Eclipse

    Now do live more and more often required to use eclipse in java and ruby & rails project conducted between the tangential shear from the past, because in the rails project used a coloring Aptana preferences, the results open the java project sour ...

  • Oracle instant clent for ruby / rails on cygwin

    Environment: XP: oracle full client, ruby, rails, gem cygwin: ruby rails, gem (the version with the XP version) Needs: for cygwin is installed under the rails platform support oci Steps: <1> download oracle instant client (10.2.0.3 Instant Client Pa

blog comments powered by Disqus
Recent
Recent Entries
Tag Cloud
Random Entries