如何使用Apache / Passenger配置Sails / Node应用程序

时间:2016-07-22 13:27:36

标签: ruby-on-rails node.js apache

首先,这仅用于开发目的。在我的Mac上,我使用Passenger运行Apache,它提供许多Rails / Ruby应用程序。 Rails的Apach配置示例如下:

<VirtualHost *:80>
    ServerName example.lc
    ServerAlias www.example.lc
    RailsEnv development
    PassengerFriendlyErrorPages on
    PassengerRuby /Users/user/.rvm/gems/ruby-2.2.3/wrappers/ruby
    DocumentRoot "/path/to/my/app/public"
    ErrorLog "/path/to/my/app/log"
    CustomLog "/path/to/my/app/log" common
    ServerAdmin example@example.com
        <Directory "/path/to/my/app/public">
            Options Indexes FollowSymLinks
            AllowOverride All
            Order allow,deny
            Allow from all
        </Directory>
</VirtualHost>

在我的主机文件中,我有192.168.0.1 www.example.lc,这样可以正常工作。

我想对基于Sails的节点应用程序做同样的事情。我尝试了以下内容:

<VirtualHost *:80>
    ServerName example.lc
    ServerAlias www.example.lc
    NODE_ENV development
    PassengerFriendlyErrorPages on
    PassengerNodejs /usr/bin/node
    DocumentRoot "/path/to/my/app/public"
    ErrorLog "/path/to/my/app/log"
    CustomLog "path/to/my/app/log" common
    ServerAdmin me@example.com
        <Directory "/path/to/my/app/public">
            Options Indexes FollowSymLinks
            AllowOverride All
            Order allow,deny
            Allow from all
        </Directory>
</VirtualHost>

但这不起作用。它也没有在日志文件中显示任何错误。有什么想法吗?

请注意,我还尝试了PassengerNodejs /Users/user/.nvm/versions/node/v4.4.7/bin/node,这是我which node时的路径。这也不起作用。

0 个答案:

没有答案
相关问题