首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >求大侠帮忙 nginx访问index.php 结果直接下载网页了?

求大侠帮忙 nginx访问index.php 结果直接下载网页了?

提问于 2018-01-11 18:49:32
回答 8关注 0查看 11.8K

求大侠帮忙 ,我是小白

centos7 +nginx1.12+php7.1

问题:nginx 访问 index.php 结果 直接下载网页了

描述:

在浏览器中,访问 CentOS 云主机公网 IP,查看 Nginx 服务可以正常运行

配置nginx文件内容如下vim /etc/nginx/conf.d/default.conf

=========================================================================

server {

listen 80;

root /usr/share/nginx/html;

server_name localhost;

#charset koi8-r;

#access_log /var/log/nginx/log/host.access.log main;

location / {

index index.php index.html index.htm;

}

#error_page 404 /404.html;

#redirect server error pages to the static page /50x.html

#

error_page 500 502 503 504 /50x.html;

location = /50x.html {

root /usr/share/nginx/html;

}

#pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

#

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;

}

}

=====================================================================

然后新建了index.php文件

vim /usr/share/nginx/html/index.php

但访问浏览器时 却直接下载了 index.php文件 http://云主机的公网 IP/index.php

恳请哪位大侠 有空帮忙解答下 非常感谢

相关文章

相似问题

相关问答用户
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档