I'm trying to get nginx to play nice with php-cgi, but it's not quite working how I'd like. I'm using some set variables to allow for dynamic host names--basically anything.local. I know that stuff is working because I can access static files properly, however php files don't work. I get the standard "No input file specified." error which normally occurs when the file doesn't exist, but it definitely does exist and the path is correct because I can access the static files in the same path. It could possibly be a permissions thing, but I'm not sure how that could be an issue. I'm running this on Windows under my own user account, so I think it should have permission unless php-cgi is running under a different user without me telling it to. >.>
Here's my config;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
server {
# Listen for HTTP
listen 80;
# Match to local host names.
server_name *.local;
# We need to store a "cleaned" host.
set $no_www $host;
set $no_local $host;
# Strip out www.
if ($host ~* www\.(.*)) {
set $no_www $1;
rewrite ^(.*)$ $scheme://$no_www$1 permanent;
}
# Strip local for directory names.
if ($no_www ~* (.*)\.local) {
set $no_local $1;
}
# Define default path handler.
location / {
root ../Users/Stephen/Documents/Work/$no_local.com/hosts/main/docs;
index index.php index.html index.htm;
# Route non-existent paths through Kohana system router.
try_files $uri $uri/ /index.php?kohana_uri=$request_uri;
}
# pass PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
root ../Users/Stephen/Documents/Work/$no_local.com/hosts/main/docs;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
# Prevent access to system files.
location ~ /\. {
return 404;
}
location ~* ^/(modules|application|system) {
return 404;
}
}
}