Welcome! Log In Create A New Profile

Advanced

Error with php (fcgi) on ubuntu hardy.

December 15, 2009 07:46PM
Hi I tried to setup an ubuntu server with nginx that is serving php sites with php fcgi.

I set up my config files like this:

[code]server {
listen 80;
server_name XXXXX;

access_log /var/log/nginx/localhost.access.log;

location / {
root /var/www/nginx-default;
index index.html index.htm;
}

location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
}
}[/code]

and I started php with the following command:

[code]php-cgi -b 127.0.0.1:9000[/code]

My fastcgi_params file looks like:

[code]fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;

fastcgi_param SCRIPT_NAME $document_root$fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;

fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;

fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;[/code]


Now I want to access a php page. But all I get is an 502 Bad Gateway Error. I know this means that something is wrong with the fcgi server - so I tried to find a hint in the error.log of nginx where I found this:

[code]2009/12/16 01:36:59 [crit] 26057#0: *1 connect() to 127.0.0.1:9000 failed (22: Invalid argument) while connecting to upstream, client: XXXXX, server: XXXXX, URL: "/index.php", upstream: "fastcgi://127.0.0.1:9000", host: "XXXXX"[/code]

This confused me because I don't understand this error message and also found no hint of something similiar with google. So maybe you have a cool idea that is taking me out of this misconfiguration.

I would be really happy if this works - I want to leave apache as fast as possible. Thanks!
Gregor
Subject Author Posted

Error with php (fcgi) on ubuntu hardy.

gremu December 15, 2009 07:46PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 70
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready