Magento下订单/结账时间 - 502 Bad Gateway

时间:2013-12-21 21:03:59

标签: php magento nginx

当我尝试在Magento下订单时,我得到了502个错误,我还试图禁用可下载产品和RSS源。

我收到订单确认电子邮件,库存更新,在管理面板我可以正确看到订单,但我没有在结帐时获得成功消息/ onepage / success /而是我得到了502错误超时。

我得到的唯一错误消息是os nginx log:

2013/12/21 18:49:47 [error] 18449#0: *191 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 177.103.69.141, server: dev.canalagricola.com.br, request: "GET /checkout/onepage/success/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "dev.canalagricola.com.br", referrer: "http://dev.canalagricola.com.br/checkout/onepage/"

我在小型实例上使用Amazon Linux(64位)(PHP5.5,PHPFPM-5.5,Nginx 1.4.3,Mysql 5.5,Magento 1.8.1)

magento.conf(nginx)

server {
    listen          80;
    server_name     dev.canalagricola.com.br;

    access_log      off;

    root            /var/www/canalagricola;
    index           index.php;

    gzip            on;
    gzip_min_length 10240;
    gzip_comp_level 9;
    gzip_proxied    expired no-cache no-store private auth;
    gzip_types      text/plain text/css text/xml text/javascript application/x-javascript application/xml application/xml+rss;
    gzip_disable    "MSIE [1-6]\.";

    sendfile        on;
    tcp_nodelay     on;
    tcp_nopush      on;

    keepalive_timeout       30;
    keepalive_requests      100000;
    reset_timedout_connection on;
    client_body_timeout     10;
    send_timeout            2;

    location / {
            try_files $uri $uri/ @handler;
            expires 30d;
    }

    location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
            log_not_found     off;
            expires           1y;
    }

    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; }

    location ~* .php$ {
            if (!-e $request_filename) { rewrite / /index.php last; }
            expires off;
            fastcgi_pass   unix:/var/run/php-fpm/php-fpm.sock;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            fastcgi_param  SCRIPT_NAME      $fastcgi_script_name;
            fastcgi_param  MAGE_RUN_CODE    default;
            fastcgi_param  MAGE_RUN_TYPE    store;
            fastcgi_read_timeout            300;
            include fastcgi_params;
    }

    rewrite ^/minify/([0-9]+)(/.*.(js|css))$ /lib/minify/m.php?f=$2&d=$1 last;
    rewrite ^/skin/m/([0-9]+)(/.*.(js|css))$ /lib/minify/m.php?f=$2&d=$1 last;

    location /lib/minify/ {
            allow all;
    }
}

www.conf(php-fpm)

[www]

listen = /var/run/php-fpm/php-fpm.sock
listen.allowed_clients = 127.0.0.1
listen.owner = nginx
listen.group = nginx
listen.mode = 0664
user = nginx
group = nginx

pm = dynamic
pm.max_children = 4
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.max_requests = 200
request_terminate_timeout = 300s
rlimit_files = 131072
rlimit_core = unlimited
catch_workers_output = yes

php_admin_value[memory_limit] = 1024M
php_admin_value[max_execution_time] = 300000

php_admin_value[error_log] = /var/log/php-fpm/5.5/www-error.log
php_admin_flag[log_errors] = on

php_value[session.save_handler] = files
php_value[session.save_path] = /var/lib/php/5.5/session

4 个答案:

答案 0 :(得分:0)

apc需要被禁用几个小时,然后你可以插入它。再次读取日志。 还有eaccelerator,有时甚至更好。

禁用整页缓存和apc并运行 ab -c 1 -n 1 http://www.campsaver.com/

然后用apc重新启动

查看速度,读取日志并启用整页缓存(如果正常)。

答案 1 :(得分:0)

Okay,

The above nginx error indicate that issue is related to the fastcgi(php-fpm).

After enabling the "catch_workers_output" on /etc/php5/fpm/pool.d/www.conf Got the relevant error on php5-fpm.log. Now understand that issue is related to AMQP module.

[21-Aug-2013 23:32:57] WARNING: [pool www] child 16091 said into stderr: "php-fpm: pool www: symbol lookup error: /usr/lib/php5/20090626/amqp.so: undefined symbol: amqp_open_socket"

Issue has been fixed afterrecompiled and install amqp module

答案 2 :(得分:0)

我注意到你使用的是PHP 5.5

根据要求,推荐使用的PHP版本为5.2.13 - 5.3.24 http://magento.com/resources/system-requirements

安装推荐的PHP版本以查看是否有任何问题。

答案 3 :(得分:0)

重新启动PHP-FPM:

/etc/init.d/php55-php-fpm restart

如果此问题仍然存在,您可以在HTTP阻止内增加缓冲区和超时:

http {
    ...
    fastcgi_buffers 8 16k;
    fastcgi_buffer_size 32k;
    fastcgi_connect_timeout 300;
    fastcgi_send_timeout 300;
    fastcgi_read_timeout 300;
    ...
}