在 Ubuntu 11.04 上设置 Passenger Phusion

发布于 2024-11-30 20:25:15 字数 1484 浏览 1 评论 0原文

我对任何说过“在 Rails 应用程序上部署 Ruby 轻而易举”之类的话感到愤怒。不,不是。这是我做过的最困难的事情,我开发操作系统。

呼。现在那已经出来了。我终于安装了passenger(使用bass ackwards安装过程),安装程序说:

请编辑你的apache配置文件并添加这些行:

LoadModule passenger_module /usr/local/rvm/gems/[email protected]/gems/passenger-3.0.8/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/[email protected]/gems/passenger-3.0.8
PassengerRuby /usr/local/rvm/wrappers/[email protected]/ruby

假设你在/某处有一个Rails应用程序。添加虚拟主机到您的 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>

我将这两个文件放入 /etc/apache2/apache2.conf 中,当我尝试启动 apache 时,它​​在我将这些垃圾放在哪一行上显示错误。非常感谢帮助。我快到了,我能感觉到!

缺口

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/[email protected]/gems/passenger-3.0.8/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/[email protected]/gems/passenger-3.0.8
PassengerRuby /usr/local/rvm/wrappers/[email protected]/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 start 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

圈圈圆圆圈圈 2024-12-07 20:25:15

成功安装 Apache 2 模块后,请按照下一步配置 Apache。

  1. 在/etc/apache2/mods-available中创建以下两个文件

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

粘贴以下代码在 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

将以下代码粘贴到 Passenger.conf 文件中

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

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. 现在,通过将以下内容添加到 /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. 现在创建您的应用程序的软链接,确保您的应用程序必须驻留在 /opt 中,为此您可以为您的应用程序创建一个单独的文件夹。

    我。 $ sudo mkdir -p /opt/rails_apps

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

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

  2. 然后使用以下命令重新启动 apache。

    /etc/init.d/apache2 restart

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

↘人皮目录ツ 2024-12-07 20:25:15

如果您逐字包含以下内容,则重新启动 Apache 时您将收到一条错误消息:

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

它吐出的错误是:

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#

修复了吗?删除后面的注释行,使其看起来像这样:

AllowOverride all
Options -MultiViews

希望这有帮助!

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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文