Welcome! Log In Create A New Profile

Advanced

nginx 502 bad gateway some pages

Posted by Max 
Max
nginx 502 bad gateway some pages
July 26, 2012 03:50PM
Hi,

I don't find the answer into this forum.So i hope you can help me.

I use nginx 1.2.2 and some page of my website return 502 bad gateway.
- xxxx.html works
- yyyy.html 502 bad gateway
xxxx.html & yyyy.html are url rewriting so it's equivalent to index.php?page=xxxx & index.php?page=yyyy
This 2 page are exactly in the same template only the texts and pictures can change.

I look into my nginx error log and i can see :
"upstream prematurely closed FastCGI stdout while reading response header from upstream"

I don't have error in my php-fpm error log.

I tried to change the buffer value but still the same issue.

My nginx.conf :

worker_processes 4;
pid /var/run/nginx.pid;

events {
worker_connections 1024;
multi_accept on;
use epoll;
}

http {

##
# Basic Settings
##

sendfile on;
tcp_nopush off;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_tokens off;
client_max_body_size 30M;
client_body_buffer_size 256K;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 280;
fastcgi_read_timeout 280;
fastcgi_buffer_size 32k;
fastcgi_buffers 256 16k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;


Do you need more informations ?

Do you see what i need to do ?

Thanks for your help :)
Max
Re: nginx 502 bad gateway some pages
August 01, 2012 02:22PM
To help some people in my case:

I've changed my php FPM configuration to :

pm = dynamic
pm.max_children = 50
pm.start_servers = 10
pm.min_spare_servers = 5
pm.max_spare_servers = 50

And also I've decomment :

listen.owner = www-data
listen.group = www-data
listen.mode = 0666

And now it works.

Solve for me even if i don't understand what it was the issue.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 253
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready