Rails Deployment(1)modrails

RailsDeployment(1)modrails

1.InstallPassenger

>sudogeminstallpassenger

>sudopassenger-install-apache2-module

Thisistheconsoleoutputofthecommand:

checkingforrequiredsoftware...

GNUC++compiler...foundat/usr/bin/g++

CurldevelopmentheaderswithSSLsupport...notfound

OpenSSLdevelopmentheaders...notfound

Zlibdevelopmentheaders...found

Rubydevelopmentheaders...found

OpenSSLsupportforRuby...found

RubyGems...found

rake...foundat/usr/bin/rake

Apache2...foundat/usr/sbin/apache2

Apache2developmentheaders...notfound

ApachePortableRuntime(APR)developmentheaders...notfound

ApachePortableRuntimeUtility(APU)developmentheaders...notfound

Ineedtoinstallalltherelatedsoftwares.

>sudoapt-getinstalllibcurl4-openssl-devor>sudoapt-getinstalllibcurl4-gnutls-dev

>sudoapt-getinstalllibssl-dev

>sudoapt-getinstallapache2-prefork-dev

>sudoapt-getinstalllibapr1-dev

>sudoapt-getinstalllibaprutil1-dev

Forthestandaloneversion,wecanusethiscommand:

>cd/home/luohua/work/projectname/

>passengerstart

Thatisok,wecanvisithttp://localhost:3000totestthewebsitesnow.

2.Configureandrunwithapache2

Andwecanalsoputtheserveronapachetogether.

Pleaseedittheapacheconfigurationfile:

>vihttpd.conf

LoadModulepassenger_module/usr/lib/ruby/gems/1.8/gems/passenger-3.0.8/ext/apache2/mod_passenger.so

PassengerRoot/usr/lib/ruby/gems/1.8/gems/passenger-3.0.8

PassengerRuby/usr/bin/ruby1.8

DeployingaRubyonRailsapplication:anexample

Supposetherailsapplicationin/somewhere.

AddavirtualhosttomyapacheconfigurationfileandsetitsDocumentRoot

to/somewhere/public:

>cd/etc/apache2/sites-available

>viprojectname

<VirtualHost*:81>

ServerNamewww.yourhost.com

DocumentRoot/somewhere/public#besuretopointtopublic

<Directory/somewhere/public>

AllowOverrideall

Options-MultiViews

</Directory>

</VirtualHost>

>cd/etc/apache2/sites-enabled

>ln-s../sites-available/projectname

whenIvisittheURLhttp://localhost:81,Igottheseerrormessages:

syntaxerror,unexpected':',expecting'}'format.json{renderjson:@accounts}

AfterIchangethesyntaxfromrenderjson:@accountstorenderjson=>@accounts.Thatisfinethen.

references:

http://www.modrails.com/install.html

相关推荐