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 1 year has passed since last update.

laravel php で File not found. エラー

Posted at

結論、nginxの書き方が間違っていた。
以下で、動作確認。

default.conf
server {
    server_name your.club;

root  /var/www/html/your.club/public;
index index.php index.html index.htm;

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



location ~ \.php$ {

  fastcgi_max_temp_file_size 0;
  fastcgi_buffer_size 4K;
  fastcgi_buffers 64 4k;

  fastcgi_connect_timeout 300;
  fastcgi_read_timeout    300;


  fastcgi_pass unix:/var/run/php-fpm.sock;
  fastcgi_index index.php;
  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  include fastcgi_params;
}




}

今回は、 laravel10をインスコ時にFile not found.エラーが発生。
ブラウザにアクセスしても上記の文章のみで動かないのだ。

そこで、エラーの切り分け。

index.html なら見れるか?

以下のフォルダに hoge.html を置いて、見れるか?

/var/www/html/your.club/public;

では、index.phpを置いてみたら?

index.php

echo "hogehoge";

に書き換えてみる。

見れない。File not found.エラー。

ログ確認

php-fpm
nginx

tail /var/log/php-fpm/error.log
tail /var/log/nginx/error.log

php設定確認

vim /etc/php-fpm.d/www.conf

再起動

sudo systemctl restart nginx
sudo systemctl restart php-fpm

って感じでデバッグしていく。

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?