zoukankan      html  css  js  c++  java
  • 配置lnmp时出现“file not found?

    问题:

      昨天测试并搭建lnmp架构,在测试过程中,挂载好测试环境时在浏览器上测试网站出现“file not found",使用命令curl时也出现”file not found",

    解答:

      查看百度时,很多方法指向添加fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;但是测试中不行,没有效果;

    分析:

      查看原理并了解php运行过程,确实网站的fastcgi找不到php文件,但是我这边配置好了php文件加载,配置如下:

    http {
    include mime.types;
    default_type application/octet-stream;
    sendfile on;
    keepalive_timeout 65;
    server {
    listen 81;
    server_name blog.etiantian.org;
    location / {
    root html/blog;
    index index.php index.html index.htm;
    }
    location ~*.*.(php|php5)?$ {
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    include fastcgi.conf;
    }
    }
    }

    但是运行并测试时就提示找不到file not found,怎么办?

    解决方法:

           为了正常显示php时,就要让他找到php网站目录,只要在

    location ~*.*.(php|php5)?$ {

    root   html/blog;    #网站目录,增加这一行;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    include fastcgi.conf;
    }

    重启nginx,php服务后就可以显示网站,如下 :

    命令行:curl blog.etiantian.org:81/1.php

    浏览器:

    恢复正常了。

  • 相关阅读:
    python字符串格式化笔记
    看球时的随笔——“如何掌握新的知识”
    str()和repre()的区别
    关于抛出异常和捕获异常
    python关键字详解
    博客的第一天
    PEP8 Python 编码规范
    SQL Server 自动循环归档分区数据脚本
    反射应用--取得类的结构
    回调函数callback使用例子
  • 原文地址:https://www.cnblogs.com/wang50902/p/10842349.html
Copyright © 2011-2022 走看看