Reputation: 291
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!
Upvotes: 2
Views: 1722
Reputation: 1190
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.
Upvotes: 4