zoukankan      html  css  js  c++  java
  • centos搭建 nginx一直报错 file not found.

    百度了半天找到别人的解决办法 记录下

    摘要: file not found. nginx php 这个问题是你配置文件的问题: 查看就是了不要管 nginx 如何开启解析 PHP 的功能? # 成功安装后,创建 php-fpm.conf 配置文件,删除 nginx.conf 中“pass the PHP scripts to FastCGI

    file not found. nginx php

    这个问题是你配置文件的问题:


    查看就是了不要管
    nginx 如何开启解析 PHP 的功能?
    # 成功安装后,创建 php-fpm.conf 配置文件,删除 nginx.conf 中“pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000”部分的注释


    cd /usr/local/php/etc

    mv php-fpm.conf.default php-fpm.conf

    vi /usr/local/nginx/conf/nginx.conf


    # 删除如下部分的注释,保存退出,


    location ~ .php$ {


        root           html;


        fastcgi_pass   127.0.0.1:9000;


        fastcgi_index  index.php;


        fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;


        include        fastcgi_params;


    }

    解决办法:

     
     
     

     fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;

    这一句有问题,请再仔细查想一下为什么?



    • 华晨@kut : 发现了更好的办法,/scripts 改成 $document_root 就好了,呵呵。 (
    • 华晨@kut : 哦,我知道了,把 /scripts 改成 /usr/local/nginx/html 就可以了。我刚才在服务器上试了一下,真的可以找到文件并且成功解析了!十分感谢! (4年前)  
    • kut@华晨: /scripts是一个目录名,也就是你站点的根目录,比如说,你访问/index.php这个文件,其实就是访问操作系统中/scripts/index.php这个文件,这个文件是否存在?(4年前)  
    •  
    重启nginx就可以解析php了。


    # 启动 php-fpm 和 nginx
    /usr/local/php/sbin/php-fpm
    /usr/local/nginx/sbin/nginx

    # 在 nginx 的 html 目录下放一个 php 文件,浏览器访问,不能解析,显示“ File not found.”
  • 相关阅读:
    权限系统概要(收集,整理)
    全程参观 Google 总部
    从Excel表格中坐标生成 点线面
    Cross Site Script 知识
    UserControl 实现From_Close
    用后立即调用Dispose
    获取鼠标点击处的颜色
    arcsde9.3 the arcsde repository is not successfully created
    ArcGIS9.3全套 下载地址
    SQLServer 2008 安装 is not a volid login or don't have permission
  • 原文地址:https://www.cnblogs.com/brady-wang/p/6086404.html
Copyright © 2011-2022 走看看