ruby-on-rails – 在nginx和unicorn设置上Rails重定向失败
我按照Railscasts第293集中的描述设置了nginx和unicorn.
当我尝试重定向时,例如
class PostsController < ApplicationController
def show
redirect_to posts_path, :notice => "Test redirect"
end
end
我被重定向到http:// unicorn / posts而不是http://mydomain.com/posts
这是我的应用程序的nginx.conf
upstream unicorn {
server unix:/tmp/unicorn.scvrush.sock fail_timeout=0;
}
server {
listen 80 default deferred;
# server_name example.com;
root /var/apps/current/public;
try_files $uri/index.html $uri @unicorn;
location @unicorn {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://unicorn;
}
keepalive_timeout 5;
}