在 Ubuntu 11.04 上设置 Passenger Phusion
我对任何说过“在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
成功安装 Apache 2 模块后,请按照下一步配置 Apache。
在/etc/apache2/mods-available中创建以下两个文件
mkdir /etc/apache2/mods-available/passenger.load
粘贴以下代码在 Passenger.load 文件中
mkdir /etc/apache2/mods-available/passenger.conf
将以下代码粘贴到 Passenger.conf 文件中
2. 通过在以下位置创建以下符号链接来启用模块/etc/apache2/mods-enabled
3. 现在,通过将以下内容添加到 /etc/apache2/sites-enabled 中的 000-default 文件来创建虚拟主机。
现在创建您的应用程序的软链接,确保您的应用程序必须驻留在 /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
然后使用以下命令重新启动 apache。
/etc/init.d/apache2 restart
After successful installation of the Apache 2 module, follow the next set of step to configure Apache.
Create the following two files in /etc/apache2/mods-available
mkdir /etc/apache2/mods-available/passenger.load
paste following code in passenger.load file
mkdir /etc/apache2/mods-available/passenger.conf
paste following code in passenger.conf file
2. Enable the modules by creating the following symbolic links in /etc/apache2/mods-enabled
3.Now create a virtual host by adding the following to 000-default file in /etc/apache2/sites-enabled.
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
Then restart apache with the following command.
/etc/init.d/apache2 restart
如果您逐字包含以下内容,则重新启动 Apache 时您将收到一条错误消息:
它吐出的错误是:
修复了吗?删除后面的注释行,使其看起来像这样:
希望这有帮助!
You will get an error message when you restart Apache if you've included, verbatim, the following:
The error it spits out is:
The fix? Remove the comment lines that follow so it looks like this:
Hope this helps!