ホームページ  >  に質問  >  本文

nginx 設定の転送についてアドバイスを求める

サーバー {
listen 443;
server_name localhost api.humanchan.me;
ssl on;
root html;
indexindex.htmlindex.htm;

if ($http_host ~ "^api.humanchan.me$") {
書き換え ^(.*) https://www.humanchan.me/api/$1 Permanent;
}

場所 ^~ /api/ {

proxy_pass http://127.0.0.1:7001;
proxy_redirect オフ;
proxy_set_header ホスト $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; to$ スキーム;
}

}

https://api.humanchan.me/ を https://www.humanchan.me/api/ に転送する必要がありますが、書き方が間違っていたのでしょうか、それともどのように書けばよいのでしょうか?

仅有的幸福仅有的幸福2714日前504

全員に返信(1)返信します

  • 怪我咯

    怪我咯2017-05-16 17:09:02

    上記のサーバーはドメイン名 api.humanchan.me をターゲットとしているため、以下に記述されている /api/ は役に立ちません。また、この設定は api.humanchan.me に対して www.humanchan.me/api/ にアクセスします。問題? ?

    返事
    0
  • キャンセル返事