私はnginxを新しくして、自分のサイトを動作させることができません(AWSのCakephpサイト)。私はメッセージが「ページは適切にリダイレクトされていません」、何かがドメインをそれ自体に追加する方法(リダイレクトループ)を取得しています。nginx cakephp仮想ホストリダイレクト
例私は自分のサイトにsub1.mysite.com
と入力すると、ブラウザにはsub1.mysite.com/sub1.mysite.com/sub1.mysite.com/sub1.mysite.com
などが追加されます。
ここに私のサイトで入手可能なコンフィグ
server {
listen 80;
server_name sub1.mysite.com;
rewrite ^(.*) http://sub1.mysite.com$1 permanent;
}
server {
listen 80; ## listen for ipv4; this line is default and implied
server_name name sub1.mysite.com;
root /var/www/sub1.mysite.com/public_html/sub-root;
index index.php index.html index.htm;
# error_page 404 errors/404.html;
access_log /var/log/nginx/sub1.mysite.com.access.log;
# Make site accessible from http://localhost/
location/{
try_files $uri $uri/ /index.php?$uri&$args;
}
location ~ .php$ {
root /var/www/sub1.mysite.com/public_html/sub-root;
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
は私が間違ってやっている任意のアイデアですか?
2日前はどこでしたか...ただ冗談を言っています:-)。真剣に、ありがとう。その作業!しかし、私が今行っている唯一の問題は 'index.php'です。navの 'pretty urls'をクリックすると動作します; ex:' sub1.mysite 'というダッシュボードをクリックします。 com \ dashboard'、それは正常に転送します。私が直接インデックスに行くと、うまく 'sub1.mysite.com/index.php'が動作します。しかし、サイトに移動してインデックスファイル(sub1.mysite.com)を指定しないとエラーが表示される** "Missing Controller Error:Sub1.mysite.comControllerが見つかりませんでした。ケーキのコントローラーにドメイン名を渡すように見えます。アイデア? – user20719
@ user20719私の編集した答えをチェックしてください。あなたが得ているエラーはCakePHPエラーですか?私はCakePHPを使ったことが一度もありません。とにかく、それがCakePHPエラーなら、あなたのnginx設定はおそらくOKですが、ルート宣言に問題があります。あなたのルータを見てみましょう – kfirba