nginx配置问题


nginx配置如下。访问首页http://127.0.0.1:8090时会直接下载入口文件,很奇怪。

但是访问http://127.0.0.1:8090/index.php可以正常进入welcome页面。

请问我哪里配错了吗。laravel版本:Laravel Framework 8.9.0

server {

  listen 8090;
  listen [::]:8090;

  server_name localhost;
  root /data/html/laraLearn/public;
  index index.php index.html index.htm;

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

  location ~ \.php$ {
      try_files $uri /index.php =404;
      fastcgi_split_path_info ^(.+\.php)(/.+)$;
      fastcgi_pass unix:/dev/shm/php-cgi.sock;
      fastcgi_index index.php;
      fastcgi_buffers 16 16k;
      fastcgi_buffer_size 32k;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      #fixes timeouts
      fastcgi_read_timeout 600;
      include fastcgi_params;
  }

  location ~ /\.ht {
      deny all;
  }

  location /.well-known/acme-challenge/ {
      root /data/html/letsencrypt/;
      log_not_found off;
  }

  error_log /usr/local/nginx/logs/lara_error.log;
  access_log /usr/local/nginx/logs/lara_access.log;
}

点赞 取消点赞 收藏 取消收藏

<< 上一篇: 新问题

>> 下一篇: Laravel 数据库迁移出现 could not find driver 错误