Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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!

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

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

share|improve this answer
    
Yes it is, what should it be? Surely the location block for any *.php file extension should override this? –  m.p.c 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 1 '11 at 7:14
    
Thanks very much for that, it worked a treat. –  m.p.c Mar 1 '11 at 9:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.