お世話になります。
nginxとlaravelのルーティングがうまく行かず、アドバイスを頂きたいです。
[事象]
https://[my domain]/public/index.phpへアクセス
↓
https://[my domain]/public/index.php/signinへ遷移後
レスポンスが 404 Not Found
となります。
/public/index.phpへアクセス後、laravelがルーティングしても
/public配下のディレクトリには自由に移動できるようになることが目標です。
[構成]
[AWS ALB] -- [AWS:ECS nginx] -- [AWS:ECS php-fpm(laravel)]
ALBのリスナーはパスベースルーティングにて /public*
を
nginxのコンテナが所属するTarget Groupへアクセスを割り振ります。
[nginx /etc/nginx/conf.d/default.conf]
server { listen 80 default; server_name _; root /var/www/html; index index.php index.html index.htm; charset utf-8; access_log /dev/stdout; error_log /dev/stderr debug; # ALBからのhealth checkに200を返す location /healthcheck { return 200 "OK"; } #location /public { # try_files $uri $uri/ /index.php$is_args$args; #} location ~* .php$ { fastcgi_pass 127.0.0.1:9000; #fastcgi_index index.php; include fastcgi_params; # laravelへうまくパスが渡せないので/public/index.phpと直書きする。 #fastcgi_param SCRIPT_FILENAME $document_root/public/$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME $document_root/public/index.php; } }
[アクセスログ]
- nginx
10.0.1.90 - - [17/Apr/2019:14:38:36 +0000] "GET /public/index.php HTTP/1.1" 302 444 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36" 2019/04/17 14:38:36 [error] 8#8: *71 open() "/var/www/html/public/index.php/signin" failed (2: No such file or directory), client: 10.0.1.90, server: _, request: "GET /public/index.php/signin HTTP/1.1", host: "[[使用しているFQDN]]" 0.0.1.90 - - [17/Apr/2019:14:38:36 +0000] "GET /public/index.php/signin HTTP/1.1" 404 556 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36"
- php-fpm
23:21:52127.0.0.1 - 17/Apr/2019:14:21:52 +0000 "GET /public/index.php" 302
宜しくお願い致します。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/04/18 03:47