求大侠帮忙 ,我是小白
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
恳请哪位大侠 有空帮忙解答下 非常感谢
相似问题