nginx running, php fast-cgi running, but .php not working ??

Hi,

I really need your help. I just installed Nginx and php fast-cgi. the both are running. With ps aux | grep nginx and ps aux | grep cgi, I will be able to check if it's running. When I test to display a simple .html file in my wen repository, I don't have any problem but when I try to display some .php extension, it's not working (with simple .php file with phpinfo()).

The error I have in my log is:

connect() failed (110: Connection timed out) while connecting to upstream

I don't know where I missed something.

Regards,

Julien

6 Replies

could you include the relevant configuration file and options for nginx/phpfastcgi?

Below my configuration file for nginx:

server {

listen 178.79.137.216:80;

server_name www.webdorado.fr;

access_log /home/webdorado/logs/access.log;

error_log /home/webdorado/logs/error.log;

location / {

root /home/webdorado/public_html/wordpress;

index index.html index.htm;

}

location ~ .php$ {

if (!-f $request_filename) {

return 404;

}

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

fastcgiparam SCRIPTFILENAME /home/webdorado/publichtml/wordpress$fastcgiscript_name;

include /etc/nginx/fastcgi_params;

}

deny access to .htaccess files, if Apache's document root

concurs with nginx's one

#

location ~ /.ht {

deny all;

}

}

and for the configuration of fat-cgi, I followed the instruction describes on this page http://library.linode.com/web-servers/n … 0.04-lucid">http://library.linode.com/web-servers/nginx/php-fastcgi/ubuntu-10.04-lucid.

!/bin/sh

/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -C 6 -u www-data -f /usr/bin/php5-cgi

Your configuration seems correct… though I don't get why the Linode Library article uses two shell scripts instead of a single init script for spawn-fcgi. It should work nonetheless.

What happens when you do … ?

/etc/init.d/php-fastcgi stop
/etc/init.d/php-fastcgi start

fastcgi is working, not problem. I founded a solution.

I replaced fastcgipass 127.0.0.1:9000; by fastcgipass unix:/tmp/fcgi.sock; and modify /usr/bin/php-fastcgi file. In Linode library, it's:

/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -C 6 -u www-data -f /usr/bin/php5-cgi

I replaced too by:

/usr/bin/spawn-fcgi -s /tmp/fcgi.sock -C 6 -u www-data -g www-data -f /usr/bin/php5-cgi

I don't know I have to use a socket???. I will ask to Linode support. Very strange. If you have an idea, you're welcome :)

Do you have some sort of firewall running on your Linode? A misconfigured firewall might interfere with localhost traffic.

Ah yes… I forgot to add this rules in my iptables. It's working now.

Thanks !

Julien

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct