nginx no input file specified 终极解决办法

网上的方法大部分都靠谱

出现这个原因 是因为路径不对,没有解析对应路径下的php文件

只要你的配置都正常一般不会出现这个问题

下面是我的nginx配置文件,以edusoho配置举例

server {
    listen 80;

    # [改] 网站的域名
    server_name ke.zh******u.com;

    #301跳转可以在nginx中配置

    # 程序的安装路径
    root /mnt/wwwroot/edusoho/web;

    # 日志路径
    access_log /mnt/log/nginx/access_edusoho.log;
    error_log /mnt/log/nginx/error_edusoho.log;

    location / {
        index app.php;
        try_files $uri @rewriteapp;
    }

    location @rewriteapp {
        rewrite ^(.*)$ /app.php?/$1 last;
    }

    location ~ ^/udisk {
        internal;
        root /mnt/wwwroot/edusoho/app/data/;
    }

    location ~ ^/(app|app_dev)\.php(/|$) {
        fastcgi_pass  unix:/tmp/php-cgi.sock;
        fastcgi_split_path_info ^(.+\.php)(/.*)\.php$;
        include fastcgi_params;
        fastcgi_param PHP_ADMIN_VALUE "open_basedir=/mnt/wwwroot/edusoho:/tmp/:/proc/";
        fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
        fastcgi_param  HTTPS              off;
        fastcgi_param HTTP_X-Sendfile-Type X-Accel-Redirect;
        fastcgi_param HTTP_X-Accel-Mapping /udisk=/mnt/wwwroot/edusoho/app/data/udisk;
        fastcgi_buffer_size 128k;
        fastcgi_buffers 8 128k;
    }

    # 配置设置图片格式文件
    location ~* \.(jpg|jpeg|gif|png|ico|swf)$ {
        # 过期时间为3年
        expires 3y;

        # 关闭日志记录
        access_log off;

        # 关闭gzip压缩,减少CPU消耗,因为图片的压缩率不高。
        gzip off;
    }

    # 配置css/js文件
    location ~* \.(css|js)$ {
        access_log off;
        expires 3y;
    }

    # 禁止用户上传目录下所有.php文件的访问,提高安全性
    location ~ ^/files/.*\.(php|php5)$ {
        deny all;
    }

    # 以下配置允许运行.php的程序,方便于其他第三方系统的集成。
    location ~ \.php$ {
        # [改] 请根据实际php-fpm运行的方式修改
        fastcgi_pass  unix:/tmp/php-cgi.sock;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;
        fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
        fastcgi_param  HTTPS              off;
    }
}

这个配置文件是没问题的,但是访问的时候频繁出现 no input file specified 

后来改了用户权限就好了

把项目目录改为:

chown -R www:www ./*

 

转载于:https://www.cnblogs.com/ailingfei/p/9279135.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值