laravel - lnmp环境index.php为什么直接下载了?
本文介绍了laravel - lnmp环境index.php为什么直接下载了?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
我是在Windows子系统ubuntu中搭建了一个lnmp环境,然后通过访问nginx配置中配置的本地域名,访问后,index。php直接被下载了,我放了一个info.php文件后可以出现phpinfo的界面,为什么单单index.php不行呢?
后面我测试了一下,我把nginx关了,访问{url}/index.php还是可以访(直接下载),不知道这是什么原因?
nginx -t配置没问题,error.log没有记录。
nginx配置如下:
server {
listen 80;
server_name demo.cc;
root /mnt/e/Workspace/laravelApp/public/;
index index.html index.htm index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
解决方案
location ~ .php$ \
改为 /
这篇关于laravel - lnmp环境index.php为什么直接下载了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文