Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have Nginx 1.4 working with php-fpm 5.3.3. I have a Magento Store running on the server. Application works fine except few POST requests.

When I saw my Access log I got following lines there:

172.16.0.207 - - [31/May/2013:00:24:25 +0530] "POST /index.php/admin/catalog_product/validate/id/49110/key/f6932144cccea264887f907c2b25b73b16e972e329d973cd6f39be4d98461715/?isAjax=true HTTP/1.1" 400 0 "http://uattest.shoppers-stop.co.in/index.php/admin/catalog_product/edit/id/49110/key/aecdb9cb7083b226ec888c033ff4b188657723ac24d31fd54991e45388d24880/" "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36"

Clearly its a BAD request. I then turned on the error_log with info mode. Then I saw the following line in error_log

2013/05/31 01:09:25 [info] 5800#0: *12 recv() failed (104: Connection reset by peer), client: 172.16.0.207, server: uattest.shoppers-stop.co.in, request: "POST /index.php/admin/catalog_product/validate/id/49110/key/f6932144cccea264887f907c2b25b73b16e972e329d973cd6f39be4d98461715/?isAjax=true HTTP/1.1", host: "uattest.shoppers-stop.co.in", referrer: "http://uattest.shoppers-stop.co.in/index.php/admin/catalog_product/edit/id/49110/key/aecdb9cb7083b226ec888c033ff4b188657723ac24d31fd54991e45388d24880/"

Please note that its NOT the error that says Connection reset by peer while reading the response from upstream

Here is my nginx.conf

 user           apache   apache;
worker_processes  12 ;

pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
}

http {
include       /etc/nginx/mime.types;
default_type  application/octet-stream;

log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                  '$status $body_bytes_sent "$http_referer" '
                  '"$http_user_agent" "$http_x_forwarded_for"';
log_format cace '***$time_local'
          'Cache Status: "$upstream_cache_status"'
          'Cache-Control: $upstream_http_cache_control'
           '"$request" ($status) in $request_time';

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

#tcp_nopush     on;

#keepalive_timeout  0;

gzip  on;

large_client_header_buffers 4 64k;
#server_tokens off;
 #open_file_cache max=10000 inactive=30m;
 #open_file_cache_valid 10m;
 #open_file_cache_min_uses 2;
 #proxy_read_timeout 600s;
#fastcgi_read_timeout 600s;
#sendfile on;
#tcp_nopush on;
# keepalive_timeout 10;
# client_max_body_size 120m;

#fastcgi_cache_path /var/cache/nginx levels= keys_zone=mage:16m max_size=10g inactive=10h;


# Load config files from the /etc/nginx/conf.d directory
# The default server is in conf.d/default.conf
include /etc/nginx/conf.d/*.conf;

}

MY php-fpm.d/www.conf

; Start a new pool named 'www'.
[www]

listen = /var/run/php-fpm/php-fpm.sock

listen.backlog = -1

listen.allowed_clients = 127.0.0.1

listen.owner = apache
listen.group = apache 
listen.mode = 0664

user = apache
; RPM: Keep a group allowed to write in log dir.
group = apache

pm = dynamic

pm.max_children = 800

pm.start_servers = 60

pm.min_spare_servers = 20

pm.max_spare_servers = 100

pm.max_requests = 10000

pm.status_path = /status

request_terminate_timeout = 300s

request_slowlog_timeout = 20s

slowlog = /var/log/php-fpm/www-slow.log

rlimit_files = 131072

rlimit_core = 0

php_admin_value[error_log] = /var/log/php-fpm/uat-error.log
php_admin_flag[log_errors] = on
;php_admin_value[memory_limit] = 128M

Here is my Vhost Hile

server {
    listen       80;

    root     /web02/ecomm-app;
    index    index.php;
    server_name uattest.shoppers-stop.co.in;

    location / {
      index  index.php;
      try_files $uri $uri/ @handler;
      expires 30d;

  }

  location ^~ /(app|includes|lib|media/downloadable|pkginfo|report/config.xml|var)/ { internal; }
  location /var/export/ { internal; }
  location /. { return 404; }
  location @handler { rewrite / /index.php; }
  location ~* .php/ { rewrite ^(.*.php)/ $1 last; }

  access_log  /var/log/nginx/uat.access.log;
  error_log  /var/log/nginx/uat.error.log;

   location /skin {
        alias /web02/ecomm-app/skin;
        access_log        off;
        allow               all;
        expires           30d;
    }

  location /media {
      alias  /web02/ecomm-app/media;
      access_log        off;
      allow           all;
      expires           30d;
  }

  location /js/ {
      alias  /web02/ecomm-app/js/;
      access_log        off;
      allow           all;
      expires           30d;
  }

  location ~* .php$ {
    expires off;
    fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock ;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param MAGE_RUN_CODE default;
    fastcgi_param MAGE_RUN_TYPE store;
    fastcgi_read_timeout 300s ;
    fastcgi_connect_timeout 300s;
    fastcgi_send_timeout 300s;

    fastcgi_buffer_size 32k;
    fastcgi_buffers 512 32k;
    fastcgi_busy_buffers_size 32k;
    fastcgi_temp_file_write_size 256k;
    fastcgi_intercept_errors off;
    include fastcgi_params;

    if ($http_cookie !~ "X-Store=1" ) {
      add_header Set-Cookie "X-Store=1; path=/";
    }
  }
}

Any help is much appreciated.

share|improve this question
    
You should have something logged in the PHP error log /var/log/php-fpm/uat-error.log corresponding to these failed requests. Check there to see if there is any additional information. –  Michael Hampton May 31 '13 at 6:01
    
@MichaelHampton I have checked the uat-error.log For these requests but there is nothing. –  SAM May 31 '13 at 6:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.