开发者

Setting up Passenger Phusion on Ubuntu 11.04

I'm furious with anyone that's ever said anything equatable to "deploying ruby on rails applications is a snap." No. It's not. It's the hardest thing I've ever had to do and I develop operating systems.

Whew. Now that that's out. I finally got passenger installed (using a bass ackwards install process) and the installer said to:

Please edit your apache configuration file and add these lines:

LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.2-p290@rails-3.0.1/gems/passenger-3.0.8/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-1.9.2-p290@rails-3.0.1/gems/passenger-3.0.8
PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.2-p290@rails-3.0.1/ruby

Suppose you have a Rails application in /somewhere. Add a virtual host to your Apache configuration file and set its DocumentRoot to /somewhere/public:

   <VirtualHost *:80>
      ServerName www.yourhost.com
      DocumentRoot /somewhere/public    # <-- be sure to point to 'public'!
      <Directory /somewhere/public>
         AllowOverride all              # <-- relax Apache security settings
         Options -MultiViews            # <-- MultiViews must be turned off
      </Directory>
   </VirtualHost>

I put both of these in /etc/apache2/apache2.conf and when I try to s开发者_StackOverflow社区tart apache it says error on which ever line i put this garbage on. Help very much appreciated. I'm almost there I can feel it!

Nick


After successful installation of the Apache 2 module, follow the next set of step to configure Apache.

  1. Create the following two files in /etc/apache2/mods-available

    mkdir /etc/apache2/mods-available/passenger.load

paste following code in passenger.load file

LoadModule passenger_module /usr/lib/ruby/gems/1.9.2(your version)/gems
/passenger-3.0.2/ext/apache2/mod_passenger.so

mkdir /etc/apache2/mods-available/passenger.conf

paste following code in passenger.conf file

PassengerRoot /usr/lib/ruby/gems/1.9.2/gems/passenger-3.0.2
PassengerRuby /usr/bin/ruby1.9.2

2. Enable the modules by creating the following symbolic links in /etc/apache2/mods-enabled

$ ln -s /etc/apache2/mods-available/passenger.load /etc/apache2/mods-enabled/passenger.load
$ ln -s /etc/apache2/mods-available/passenger.conf /etc/apache2/mods-enabled/passenger.conf

3.Now create a virtual host by adding the following to 000-default file in /etc/apache2/sites-enabled.

<Directory /var/www/your_app>
         RailsBaseURI /your_app
         RailsEnv development
         AllowOverride all
         Options -MultiViews
         allow from all
</Directory>
  1. Now create soft link of your application, make sure you application must reside in /opt , To do you may create a separate folder for your application.

    i. $ sudo mkdir -p /opt/rails_apps

    ii. $ sudo cp -R /path/to/your_app/ /opt/rails_apps/

    iii. $ sudo ln -s /opt/rails_apps/your_app/public/ /var/www/your_app

  2. Then restart apache with the following command.

    /etc/init.d/apache2 restart


You will get an error message when you restart Apache if you've included, verbatim, the following:

AllowOverride all              # <-- relax Apache security settings
Options -MultiViews            # <-- MultiViews must be turned off

The error it spits out is:

user@my_server:~/your_site# sudo /etc/init.d/apache restart
Syntax error on line 11 of /etc/apache2/sites-enabled/your_site:
Illegal override option #
Action 'configtest' failed.
The Apache error log may have more information.
   ...fail!
root@my_server:~/your_site#

The fix? Remove the comment lines that follow so it looks like this:

AllowOverride all
Options -MultiViews

Hope this helps!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜