Rails Passenger和Nginx + GeoIP模块

时间:2016-02-14 18:08:23

标签: ruby-on-rails nginx passenger

我一如既往地安装passanger gem,然后:

/***
 * @name array_flatten
 * @author Tom Penzer @tpenzer
 * Flattens a multi-tiered array into a single-tiered 
 * associative array with keys reflective of their 
 * values' hierarchy.
 *
 * @param    array    $array       Required - the multi- 
 * level keyed array to be flattened
 * @param    string   $separator   Optional - the string 
 * used to separate the keys from different levels of 
 * the hierarchy
 *
 * @return   array    a single-level keyed array
 ***/
function array_flatten($array, $separator = '_') {
    $output = array();

    while (list($key, $value) = each($array)) {
        if (is_array($value)) {
            $build = array();
            foreach ($value as $s_key => $s_value) {
                $build[$key . $separator . $s_key] = $s_value;
            }
            unset($array[$key]);
            $array = $build + $array;
            unset($build);
            continue;//skip write to $output
        }
        $output[$key] = $value;
        unset($array[$key]);
    }

    return $output;
}

我选择了自动配置和

rvmsudo passenger-install-nginx-module

nginx的文件夹。

现在我写的时候

/opt/nginx

我只看到

nginx -V

usr / local / bin为空。

当然应用程序有效但我尝试安装GeoIP并且无法检查nginx安装了哪些模块。

解答:

rvmsudo passenger-nginx-module的标准自动安装不会加载附加模块。

1 个答案:

答案 0 :(得分:0)

看起来安装过程出了问题。根据{{​​3}},安装乘客这样做(考虑到你使用的是Ubuntu 14.04):

# Install our PGP key and add HTTPS support for APT
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7
sudo apt-get install -y apt-transport-https ca-certificates

# Add our APT repository
sudo sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger trusty main > /etc/apt/sources.list.d/passenger.list'
sudo apt-get update

# Install Passenger + Nginx
sudo apt-get install -y nginx-extras passenger

如果您已在系统上安装了nginx,则此命令只会将Nginx升级为Phusion的版本(编译为Passenger)。

开始吧:

sudo service nginx restart

通过运行

检查其是否正常工作
sudo passenger-config validate-install