dongpang1232 2015-07-16 10:06
浏览 416

Nginx + php-fpm返回空白页面或“未指定输入文件”

I am using nginx with php5-fpm on a Debian stable system. Here is my default site:

server {
listen 443 default_server;
server_name _;

root /home/www/known;

# Deny access to dot files and dirs
location ~ /\. {
    access_log off;
    log_not_found off;
    deny all;
}

# Enable PHP for vhosts
index index.php index.html index.htm index.nginx-debian.html;
location ~ \.php$ {
    # regex to split $uri to $fastcgi_script_name and $fastcgi_path
    fastcgi_split_path_info ^(.+\.php)(/.+)$;

    # Check that the PHP script exists before passing it
    try_files $fastcgi_script_name =404;

    # Bypass the fact that try_files resets $fastcgi_path_info
    # see: http://trac.nginx.org/nginx/ticket/321
    set $path_info $fastcgi_path_info;
    fastcgi_param PATH_INFO $path_info;

    fastcgi_index index.php;
    include fastcgi.conf;

    fastcgi_pass   unix:/var/run/php5-fpm.sock;
}

ssl on;
ssl_certificate /etc/ssl/certs/phyks.me/root.crt;
ssl_certificate_key /etc/ssl/private/phyks.me/root.key;

location / {
    # First attempt to serve request as file, then
    # as directory, then fall back to displaying a 404.
    try_files $uri $uri/ =404;
}
}

The PHP part is taken from the php fastcgi snippet bundled with Nginx in Debian. The /home/www/known/index.php file exists and is readable by www-data (which both nginx and php-fpm runs as) but I get a "no input file specified" although the file path is passed correctly by nginx to php-fpm.

I tried to replace the content of the location block for php files by

include fastcgi_params;
fastcgi_pass   unix:/var/run/php5-fpm.sock;

In this case I have a blank page (with status 200) and cannot get any verbose output to the log, either from php5-fpm or nginx.

I have been stuck hours with this, trying different config options, but could not figure out what is going on… Do you have any ideas? Plus similar configuration works on other servers.

Thanks!

  • 写回答

1条回答 默认 最新

  • dsf487787 2015-07-16 12:52
    关注

    Please check if your /etc/nginx/fastcgi.conf or /etc/nginx/fastcgi_params includes this param SCRIPT_FILENAME $request_filename; or else append it to file.

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog