0

I have Nginx and PHP 5.3.5 running on my at Windows PC at work (I don't have administrator rights).

Serving static content works as expected, but when using FastCGI with PHP Nginx serves the PHP page as downloadable content, so I get a 'save as...' dialogue.

I have PHP-CGI.exe bound to localhost:9000, even when I don't have the PHP-CGI process running the same thing happens, so it appears that the request never leaves the Nginx process.

This happens with Nginx v0.8.54 and v0.9.5, my Nginx FastCGI configuration is as follows...

location ~ \.php$ {
    root           html;
    fastcgi_pass   localhost:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  $fastcgi_script_name;
    include        fastcgi_params;
}

Any ideas why this is happening? Is it a Windows Firewall issue? Any help would be greatly appreciated!

chattsm
  • 329
  • 2
  • 3
  • 7

1 Answers1

0

Your location block is fine. Check if your default_type isn't set to application/octet-stream.

Martin Fjordvald
  • 7,749
  • 1
  • 30
  • 35
  • Yes it is, what should it be? Surely the location block for any *.php file extension should override this? – chattsm Feb 28 '11 at 22:19
  • @MartinChatterton Nginx does not understand that it's a PHP location. Nginx understand one thing and one thing only, URIs. It does not understand the difference between one URI and the other. So if you specify default_type as application/octet-stream and you don't override it in a location or in a backend header then that's what it'll be. You can probably safely set it to text/html but you should read up on mime types. – Martin Fjordvald Mar 01 '11 at 07:14