看到文档根目录而不是我正在运行的 Rails 应用程序,带有 Phusion Passenger 的 Ubuntu VPS

发布于 2024-11-28 16:37:31 字数 2870 浏览 0 评论 0原文

我在我的 VPS 上运行 ubuntu,并安装了 apache 和 phusion guest 来部署我的 Rails 应用程序。我完成了 phusion乘客的设置,一切都安装得很好。我编辑了 apache 配置文件并附加了以下信息。我还确保虚拟主机不会被覆盖默认主机,当我更改它并刷新浏览器时,我被带到了 Rails 应用程序的公共目录,而不是执行 Rails 应用程序。任何帮助将不胜感激。

添加到 /etc/apache/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
PassengerDefaultUser www-data


<VirtualHost *:80>
            ServerName localhost
    DocumentRoot /home/bodylabel/globify/public
    <Directory /home/bodylabel/globify/public>
        Allow from all
        Options -MultiViews
    </Directory>
</VirtualHost>

/etc/apache2/sites-enabled/000-default

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined
    # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

/etc/host.conf

# The "order" line is only used by old versions of the C library.
order hosts,bind
multi on

刚刚运行 sudo Passenger-status 并返回以下内容:

*** Cleaning stale folder /tmp/passenger.44591
*** Cleaning stale folder /tmp/passenger.44300
*** Cleaning stale folder /tmp/passenger.44372
*** Cleaning stale folder /tmp/passenger.44200
*** Cleaning stale folder /tmp/passenger.21157
*** Cleaning stale folder /tmp/passenger.43944
*** Cleaning stale folder /tmp/passenger.21589
*** Cleaning stale folder /tmp/passenger.44878
ERROR: Phusion Passenger doesn't seem to be running.

I am running ubuntu on my VPS and have installed apache as well as phusion passenger to deploy my rails apps with. I went through the setup for phusion passenger and everything installed just fine. I edited the apache configuration files and have appended the information below. I have also made sure that the Virtualhost is not being overridden the default host and when I changed that and refreshed a browser I was brought to the public directory of my rails app instead of having the rails app being executed. Any help would be appreciated.

additions to /etc/apache/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
PassengerDefaultUser www-data


<VirtualHost *:80>
            ServerName localhost
    DocumentRoot /home/bodylabel/globify/public
    <Directory /home/bodylabel/globify/public>
        Allow from all
        Options -MultiViews
    </Directory>
</VirtualHost>

/etc/apache2/sites-enabled/000-default

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined
    # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

/etc/host.conf

# The "order" line is only used by old versions of the C library.
order hosts,bind
multi on

Just ran sudo passenger-status and got back the following:

*** Cleaning stale folder /tmp/passenger.44591
*** Cleaning stale folder /tmp/passenger.44300
*** Cleaning stale folder /tmp/passenger.44372
*** Cleaning stale folder /tmp/passenger.44200
*** Cleaning stale folder /tmp/passenger.21157
*** Cleaning stale folder /tmp/passenger.43944
*** Cleaning stale folder /tmp/passenger.21589
*** Cleaning stale folder /tmp/passenger.44878
ERROR: Phusion Passenger doesn't seem to be running.

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

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

发布评论

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

评论(2

临走之时 2024-12-05 16:37:31

这是一个强制性的愚蠢问题,但是,你重新启动 apache 了吗?

另外,虽然这可能不是问题的根源,但您可能需要使用 debian 式的方法在此处部署站点,并将虚拟主机配置放入 /etc/apache2/sites-available 中,运行 a2ensite 来激活它。

对于可用模块和启用模块可能有类似的构造,您可以将乘客代码放在其中,而不是放在 apache2.conf 中。

the obligatory dumb question, but, did you restart apache?

Also, although this probably isn't the source of your problem, you may want to use the debian-esque method of deploying sites here and drop that virtualhost config into /etc/apache2/sites-available and run a2ensite to activate it.

There's probably a similar construct in place for modules-available and modules-enabled, where you might put that passenger code, rather than in apache2.conf.

青瓷清茶倾城歌 2024-12-05 16:37:31

您有两个 IP/端口名称为 *:80VirtualHost。 Apache 将在这里做两件事之一。 如果您的配置中有匹配的 NameVirtualHost 指令,那么它将在其中查找 ServerName (和 ServerAlias)指令这两个虚拟主机部分,如果传入请求与这些服务器名称/别名匹配,那么它将为该虚拟主机提供服务。

否则,它将提供配置文件中首先定义的第一个 VirtualHost 块。因此,提供哪一个服务将取决于 sites-enabled/000-default 相对于 VirtualHost 部分在 apache2.conf 中的位置的包含顺序。配置文件

You have two VirtualHost with the ip/port name *:80. Apache will do one of two things here. If you have a matching NameVirtualHost directive in your config then it will look for ServerName (and ServerAlias) directives within those two virtual host sections, and if the incoming request matches those server names/aliases then it will serve that virtual host.

Otherwise, it will serve the first VirtualHost block that is defined first in your configuration files. So, which one is being served will depend on the order that sites-enabled/000-default is included relative to the location of the VirtualHost section in apache2.conf

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