为了账号安全,请及时绑定邮箱和手机立即绑定

lnmp环境index.php为什么直接下载了?

lnmp环境index.php为什么直接下载了?

PHP
三国纷争 2019-03-18 17:13:25
我是在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; } }
查看完整描述

3 回答

?
千万里不及你

TA贡献1784条经验 获得超9个赞

location ~ .php$ \改为 /

查看完整回答
反对 回复 2019-03-18
?
慕容森

TA贡献1853条经验 获得超18个赞

如果是修改了配置,记得重启下nginx
,这个解析php后面有$吗?我看我的好像没有
https://img1.sycdn.imooc.com//5c8f6ca80001a28404030136.jpg

查看完整回答
反对 回复 2019-03-18
  • 3 回答
  • 0 关注
  • 1866 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信