First of all: I'm not an expert in configuring things. This is very new for me, so, my apologies in advance.

At work we have a Centos server. The guy who worked here before installed nginx. We need to made a php site, so, obviously, I need to set up php and make it work with nginx.

Making short a very long tale, I had to replace the nginx binary with a new one (because the older was compile without fast-cgi), and I had to recompile and install php (because the new version has fpm). Then I struggle with the config files, making this nginx.conf (not all the file)

3 Answers
3

first of all check that php-fpm is listening on 9000 port:
netstat -an | grep LISTEN | grep 9000
if it return something like:
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN
then php-fpm works and you should check your nginx configuration. i.e. check if you defined right server_name. it should be the same as you enter it in your browser. if you use some other urls than localhost make sure you have right DNS record for this urls.
mine config for php-fpm is:

This works for me on nginx 0.8.54. The "fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;" is probably the only thing you need to change. It uses the "root /var/www/example.com/yoursite" directive in your server config. I've had it throw errors up at me before in the past, by only serving up a white page. You can see the errors usually in /var/log/nginx/error.log. Also, did you set up php-fpm to run on TCP port or socket? Check your php-fpm.conf, I think it defaults to TCP port 9000.
this nginx.org page has a whole bunch of default configurations for various open source web apps (wordpress, drupal, etc.).