7
Railscasts#293で説明されているように、nginxとunicornで実行するようにセットアップしました。このようnginxとunicornの設定でRailsのリダイレクトが失敗する
class PostsController < ApplicationController
def show
redirect_to posts_path, :notice => "Test redirect"
end
end
として
私はリダイレクトしようと、私が代わりにhttp://mydomain.com/posts
のhttp://unicorn/posts
にリダイレクトは、ここでこれは私の作品のアプリ
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;
}
私が代わりに私が持っている場所の@ unicorn' '場所/' 'の、同様の設定を持っています。あなたはそれを試しましたか? – Frost
@MartinFrostうん、助けてくれなかった。それは、ドメイン名ではなく、ベースURLとしてproxy_pass URLを使用するようです。 –
あなたの '。/ config/unicorn.rb'コンテンツも投稿できますか?例えば'listen'ディレクティブの行。 – Tilo