简体   繁体   English

在Ubuntu 11.04上设置Passenger Phusion

[英]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." 我对任何人都曾说过“部署Rails应用程序中的红宝石很容易”的说法感到愤怒。 No. It's not. 不,这不对。 It's the hardest thing I've ever had to do and I develop operating systems. 这是我做过的最艰难的事情,我正在开发操作系统。

Whew. ew。 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: 请编辑您的apache配置文件并添加以下行:

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. 假设您在/ somewhere中有一个Rails应用程序。 Add a virtual host to your Apache configuration file and set its DocumentRoot to /somewhere/public: 将虚拟主机添加到Apache配置文件,并将其DocumentRoot设置为/ 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 start apache it says error on which ever line i put this garbage on. 我把这两个都放在/etc/apache2/apache2.conf中,当我尝试启动apache时,我在哪一行上都写了这个垃圾,上面写着错误。 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. 成功安装Apache 2模块后,请按照下一组步骤配置Apache。

  1. Create the following two files in /etc/apache2/mods-available 在/ etc / apache2 / mods-available中创建以下两个文件

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

paste following code in passenger.load file 将以下代码粘贴到passenger.load文件中

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 mkdir /etc/apache2/mods-available/passenger.conf

paste following code in passenger.conf file 将以下代码粘贴到passenger.conf文件中

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 2.通过在/ 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. 3.现在,通过在/ etc / apache2 / sites-enabled中的000-default文件中添加以下内容来创建虚拟主机。

<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. 现在创建应用程序的软链接,确保您的应用程序必须位于/ opt中。为此,您可以为应用程序创建一个单独的文件夹。

    i. 一世。 $ sudo mkdir -p /opt/rails_apps $ sudo mkdir -p / opt / rails_apps

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

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

  2. Then restart apache with the following command. 然后使用以下命令重新启动apache。

    /etc/init.d/apache2 restart /etc/init.d/apache2重新启动

You will get an error message when you restart Apache if you've included, verbatim, the following: 如果逐字包含以下内容,则在重新启动Apache时将收到错误消息:

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! 希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM