0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

nginx から PHP-FPM に URL パラメータを渡す

Posted at

Laravel のページャー機能を使おうとしたら $_GET に URL パラメータが渡ってなくてうまく動かず。
PHP/Laravel や nginx のアクセスログでは、ちゃんとリクエスト URI にパラメータは渡ってるし、もちろんリダイレクトなどによって URI が書き換えられているようなこともなく 🤔 状態。

nginx から PHP に転送するときに意図した挙動をしてない感じだったので、nginx の conf をちょろちょろ書き換えながらしばらく格闘。

nginx の version は 1.18-alpine。

FROM nginx:1.18-alpine

以下のような変更をでうまく動きました。

server {
    ...

    location / {
        try_files $uri $uri/ /index.php$query_string;
    }

    ...
}

server {
    ...

    location / {
        try_files $uri $uri/ /index.php$is_args$args;
    }

    ...
}

$query_string$args に変えただけ。

nginx ムズカシイ。

おしまい。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?