小编sor*_*bh 的帖子

Nginx proxy_next_upstream不起作用

我希望nginx首先在本地主机上搜索该文件,并在404错误时搜索服务器1.1.1.1.

我能够获取位于本地主机上的文件,但无法从服务器1.1.1.1获取.

server {
    listen 80;
    server_name  localhost;

    access_log /var/log/nginx/access.log main;

    location /products/ {
        proxy_next_upstream http_404;

        root /var/foo;
    }
}

server {
    listen 80;
    server_name  1.1.1.1;
    location /products/ {
        #########
    }
}
Run Code Online (Sandbox Code Playgroud)

我猜proxy_next_upstream没有切换到服务器.

任何有关这方面的帮助将不胜感激.

nginx

10
推荐指数
1
解决办法
2万
查看次数

主动资源抱怨期望哈希

我正在使用活动资源从api获取数据并显示它,
我的控制器model.rb有

class Thr::Vol::Dom < ActiveResource::Base
  class << self
    def element_path(id, prefix_options = {}, query_options = nil)
      prefix_options, query_options = split_options(prefix_options) if query_options.nil?
      "#{prefix(prefix_options)}#{collection_name}/#{id}#{query_string(query_options)}"
    end

    def collection_path(prefix_options = {}, query_options = nil)
      prefix_options, query_options = split_options(prefix_options) if query_options.nil?
      "#{prefix(prefix_options)}#{collection_name}#{query_string(query_options)}"
    end
  end

  ActiveResource::Base.site = 'http://10.00.0.00:8888/'

  self.format = :json
  self.collection_name= "/vv/test/domains"

  def self.find
    x = superclass.find(:one, :from => '/vv/test/domains/2013-06-25T05:03Z')
    x
  end
end
Run Code Online (Sandbox Code Playgroud)

当我调用此Thr :: Vol :: Dom.find方法时,它返回以下错误:

ArgumentError: expected an attributes Hash, 
  got ["0.0.0.0", "1.1.1.1", "2.2.2.2", "3.3.3.3", "4.4.4.4"]
Run Code Online (Sandbox Code Playgroud)

预计api会提供类似这样的东西

{"abs.com":["0.0.0.0", "1.1.1.1", "2.2.2.2", …
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails activeresource ruby-on-rails-3

6
推荐指数
2
解决办法
4200
查看次数