Welcome! Log In Create A New Profile

Advanced

I still have errors like 502 Bad Gateway and upstream problems :/

Posted by loran 
I still have errors like 502 Bad Gateway and upstream problems :/
February 20, 2014 05:37AM
Hello

On a server driven by NGINX with PHP-FPM I'm trying to eliminate errors like
- 502 Bad Gateway
- recv() failed (104: Connection reset by peer) while reading response header from upstream, client: xx.xx.xx.xx, server: example.com, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9017", host: "example.com"
- connect() failed (111: Connection refused) while connecting to upstream, client: xx.xx.xx.xx, server: example.com, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9017", host: "example.com"

I have tried many configuration changes.
- added buffers
- stop using sockets (for Bad Gateway)...

I still have those errors and it's driving me crazy.
Here are my conf files :

Here is my /etc/nginx/nginx.conf

================================================================
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;

events {
worker_connections 2048;
# multi_accept on;
}

http {

##
# Basic Settings
##

sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 100;
client_max_body_size 10m;
client_header_timeout 1460;
client_body_timeout 1460;
types_hash_max_size 2048;
server_tokens off;
index index.php index.htm index.html redirect.php;

# server_names_hash_bucket_size 64;
# server_name_in_redirect off;

include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_disable "MSIE [1-6].(?!.*SV1)";
gzip_types text/plain text/css application/json application/x-javascript text/xml
application/xml application/xml+rss text/javascript;

#FastCGI
fastcgi_intercept_errors on;
fastcgi_ignore_client_abort on;
fastcgi_buffers 256 16k;
fastcgi_buffer_size 32k;
fastcgi_connect_timeout 300;
fastcgi_read_timeout 300;
fastcgi_send_timeout 300;
fastcgi_index index.php;

#microcache
fastcgi_cache_path /var/cache/nginx2 levels=1:2 keys_zone=microcache:5m max_size=1000m;
log_format cache '$remote_addr - $remote_user [$time_local] "$request" '
'$status $upstream_cache_status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
================================================================

Here is my /etc/nginx/sites-available/example.com.vhost

================================================================
server {
listen *:80;
server_name example.com ;
root /var/www/example.com/web;
index index.html index.htm index.php index.cgi index.pl index.xhtml;
..........
location @php {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9017;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
}
..........
================================================================

Here is my /etc/php5/fpm/pool.d/xxxxxx.conf relative to example.com
================================================================
[web8]

listen = 127.0.0.1:9017
listen.allowed_clients = 127.0.0.1

user = web8
group = client1

pm = dynamic
pm.max_children = 10
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 5
pm.max_requests = 0
...............
================================================================


Please, do you see parameters that are wrong ?

Thank you by advance
Re: I still have errors like 502 Bad Gateway and upstream problems :/
February 20, 2014 08:24AM
Some more information :

The server is based on a Intel Xeon E3-1245v2 (4C/8T) @3.4 Ghz + 32 Gb RAM, and receives 300 visitors / secondes.
Re: I still have errors like 502 Bad Gateway and upstream problems :/
March 04, 2014 03:21AM
What is the error on your php-fpm log?
Re: I still have errors like 502 Bad Gateway and upstream problems :/
March 04, 2014 08:56AM
Hi teewhey

/var/log/php5-fpm.log has no error inside.
/var/log/nginx/error.log nothing interesting also.


in /var/log/ispconfig/httpd/xxxxxx.com/error.log, lines like

2014/03/01 10:36:01 [error] 2853#0: *3688308 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: xx.xx.xx.xx, server: xxxxxx.com, request: "GET /?source=xxxxxx HTTP/1.1", upstream: "fastcgi://127.0.0.1:9014", host: "www.xxxxxx.com", referrer: "http://www.xxxxxx.com/"

or

2014/02/27 09:22:59 [error] 2853#0: *1112414 connect() failed (111: Connection refused) while connecting to upstream, client: xx.xx.xx.xx, server: xxxxxx.com, request: "GET /xxxxxx.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9017", host: "xxxxxx.com"


in /var/log/ispconfig/httpd/xxxxxx.com/access.log, lines that have 502 BAD GATEWAY like

xx.xx.xx.xx - - [04/Mar/2014:14:27:01 +0100] "GET /?xxxxxx HTTP/1.1" 502 568 "-" "Mozilla/5.0 (Windows NT 6.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36"

regards
Re: I still have errors like 502 Bad Gateway and upstream problems :/
March 13, 2014 12:34AM
I meant php-fpm logs... /var/log/php-fpm.log or sort
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 183
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