宝塔1024及双11特惠活动,企业版1099元/年,送SSL证书,最高立减2万元!查看活动
当前位置:论坛首页 > Linux面板 > 求助

Nginx 1.12无法正确解析php 访问页面直接就下载了php文件

发表在 Linux面板2017-7-3 15:57 [复制链接] 11 8944

Nginx 1.12无法正确解析php 访问页面直接就下载了php文件

要怎么解决
使用道具 举报 只看该作者 回复
发表于 2017-7-3 17:02:54 | 显示全部楼层
没人能回答一下吗
使用道具 举报 回复 支持 反对
发表于 2017-7-3 17:06:41 | 显示全部楼层
你安装PHP了吗
使用道具 举报 回复 支持 反对
发表于 2017-7-3 17:10:56 | 显示全部楼层
站点那里切换一下php版本 或者你发你网站的站点配置文件出来看看
QQ图片20170703170822.png
使用道具 举报 回复 支持 反对
发表于 2017-7-3 17:12:14 | 显示全部楼层
安装了,就是无法解析php,就是配置nginx.conf 出了问题,不知道如何配置
使用道具 举报 回复 支持 反对
发表于 2017-7-3 18:34:06 | 显示全部楼层
1499077473(1).png
只要我在nginx.conf里添加这段代码网站就无法正确解析php
使用道具 举报 回复 支持 反对
发表于 2017-7-3 19:21:07 | 显示全部楼层
自己已经解决了,是nginx.conf的配置问题
使用道具 举报 回复 支持 反对
发表于 2017-7-4 13:58:56 | 显示全部楼层
怎么解决的?
使用道具 举报 回复 支持 反对
发表于 2017-7-4 14:31:41 | 显示全部楼层
nginx本身是不用解析PHP的,要用PHP来解析,。访问到php程序时,nignx会把访问要求转交给php进行处理。

你重新还原一下配置文件,简单的就要删除了现在的nginx再重装一下。
使用道具 举报 回复 支持 反对
发表于 2017-7-4 14:36:24 | 显示全部楼层
yangsanwei 发表于 2017-7-3 18:34
只要我在nginx.conf里添加这段代码网站就无法正确解析php

你添加的这一段代码,加错了位置。。

你只要加到原来网站的server里就行了,不要在同一个站点的配置文件里再加一个server。

使用道具 举报 回复 支持 反对
发表于 2017-7-4 14:42:21 | 显示全部楼层
server
    {
        listen 80;
        listen 443 ssl;
        #listen [::]:80;
        server_name 5137bj.com www.5137bj.com;
        add_header Strict-Transport-Security "max-age=31536000; includeSubdomains; preload";
        index index.html index.htm index.php default.html default.htm default.php;
        root  /**/5137bj.com;
        
        include wordpress.conf;
        #error_page   404   /404.html;
        include enable-php.conf;

        ssl on;
        ssl_certificate /**/www.5137bj.com_bundle.crt;
        ssl_certificate_key /**/www.5137bj.com.key;
        ssl_session_timeout 5m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
        ssl_prefer_server_ciphers on;



        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }

        location ~ .*\.(js|css)?$
        {
            expires      12h;
        }

        location ~ /\.
        {
            deny all;
        }


        access_log  /**/5137bj.log;
    }
                                                
使用道具 举报 回复 支持 反对
发表于 2019-4-28 15:57:33 | 显示全部楼层
宝塔面板中打开网站设置->配置文件,server段中增加如下配置,即可

    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;
    }
使用道具 举报 回复 支持 反对
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

普通问题处理

论坛响应时间:72小时

问题处理方式:排队(仅解答)

工作时间:白班:9:00 - 18:00

紧急运维服务

响应时间:3分钟

问题处理方式:宝塔专家1对1服务

工作时间:工作日:9:00 - 18:30

宝塔专业团队为您解决服务器疑难问题

立即付费处理

工作时间:09:00至24:00

快速回复 返回顶部 返回列表