使用 Phusion Passenger 将 Rails 应用程序部署到 LAMP 服务器
我刚刚完成了我的第一个 Rails 应用程序,并准备部署到我的 VPS。我决定尝试使用 Phusion Passenger 并完成了极其简单的安装过程。我得到了所有正确的依赖项,所以就这一点而言,事情似乎没问题。我认为我的问题出在路由和 apache 配置文件中。
正如所告知的,我在以下文件的最后添加了以下内容: /etc/apache2/apache2.conf
LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-3.0.8/ext/apache2/mod_passenger.so
PassengerRoot /var/lib/gems/1.8/gems/passenger-3.0.8
PassengerRuby /usr/bin/ruby1.8
<VirtualHost *:80>
ServerName localhost
DocumentRoot /home/bl/gfy/public
<Directory /home/bl/gfy/public>
Allow from all
Options -MultiViews
</Directory>
</VirtualHost>
当我重新启动 apache 时,我收到以下消息:
* Restarting web server apache2 [Wed Aug 10 03:16:24 2011] [warn] module passenger_module is already loaded, skipping
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
... waiting [Wed Aug 10 03:16:26 2011] [warn] module passenger_module is already loaded, skipping
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
当我将浏览器指向我设置的 IP 时,我得到指向apache 附带的示例文件,而不是我的 Rails 应用程序。
任何想法将不胜感激。
谢谢。
I just finished working on my first rails app and am ready to deploy to my VPS. I decided to try using Phusion Passenger and went through the extremely simple install process. I got all the right dependencies, so on that end things seems to be ok. Where I think my problem lies is in the routing and the apache config file.
As told I added the following at the very end of the following file: /etc/apache2/apache2.conf
LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-3.0.8/ext/apache2/mod_passenger.so
PassengerRoot /var/lib/gems/1.8/gems/passenger-3.0.8
PassengerRuby /usr/bin/ruby1.8
<VirtualHost *:80>
ServerName localhost
DocumentRoot /home/bl/gfy/public
<Directory /home/bl/gfy/public>
Allow from all
Options -MultiViews
</Directory>
</VirtualHost>
When I restart apache I get the following message:
* Restarting web server apache2 [Wed Aug 10 03:16:24 2011] [warn] module passenger_module is already loaded, skipping
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
... waiting [Wed Aug 10 03:16:26 2011] [warn] module passenger_module is already loaded, skipping
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
When I point my browser to my the IP I set up I get pointed to the sample file that comes with apache instead of to my rails app.
Any ideas would be greatly appreciated.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
与您的问题有些无关,但仍然如此。
您看到的两个警告并不重要,不应影响服务器操作。
一个意味着您的服务器主机名尚未设置,另一个只是提醒您乘客已经从某个地方加载,可能是在
/etc/apache/modules.d
中偶然发现之后。总而言之,您并不是真的想编辑
/etc/apache/apache2.conf
。而是使用现有的结构,例如/etc/apache2/sites-available
等。现在回到您的问题。
您的 VirtualHost 很可能被默认主机覆盖。
在 shell 中执行 sudo a2dissite default 将会禁用它。假设你没有一些异国情调的 LAMP 味道。
Somewhat unrelated to your problem, but still.
Both warning you see are not critical and should not affect server operations.
One means that your server hostname is not set, another just reminds you that passenger is already loaded from somewhere, probably after it stumbles upon in
/etc/apache/modules.d
.All in all, you don't really want to edit
/etc/apache/apache2.conf
. Instead use existing structures, like/etc/apache2/sites-available
etc.Now back to your problem.
Your VirtualHost is most likely being overriden by default host.
Executing
sudo a2dissite default
in your shell will disable it. Assuming you don't have some exotic LAMP flavor.