I have a server setup with Nginx 1.1.4
+ PHP-FPM + APC. On this server a Magento 1.5.1.0
installation is running. What I'm having trouble with is that the callback from the payment provider is a POST and Nginx returns a 302 which makes the callback fail.
This is the config file for Nginx for the site:
server {
listen 80;
server_name <domain>;
root <path to root>;
if ($host ~* ^([a-z0-9\-]+\.(com|net|org))$) {
set $host_with_www www.$1;
rewrite ^(.*)$ http://$host_with_www$1 permanent;
}
location / {
index index.html index.php;
try_files $uri $uri/ @handler;
expires 30d;
}
location /nginx_status {
stub_status on;
access_log off;
#allow 127.0.0.1;
#deny all;
allow all;
}
location /app/ { deny all; }
location /includes/ { deny all; }
location /lib/ { deny all; }
location /media/downloadable/ { deny all; }
location /pkginfo/ { deny all; }
location /report/config.xml { deny all; }
location /var/ { deny all; }
location /var/export/ {
auth_basic "Restricted";
auth_basic_user_file htpasswd;
autoindex on;
}
location /. {
return 404;
}
location @handler {
rewrite / /index.php;
}
location ~ .php/ {
rewrite ^(.*.php)/ $1 last;
}
location ~ .php$ { ## Execute PHP scripts
if (!-e $request_filename) { rewrite / /index.php last; }
expires off; ## Do not cache dynamic content
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
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 MAGE_RUN_CODE default;
fastcgi_param MAGE_RUN_TYPE store;
fastcgi_buffers 256 16k;
fastcgi_buffer_size 32k;
include fastcgi_params; ## See /etc/nginx/fastcgi_params
}
}
When the callback is made this is what the access log looks like:
85.236.67.1 - - [18/Oct/2011:09:52:03 +0000] "POST /Dibs/Dibs/callback HTTP/1.1" 302 5 "-" "DIBS"
Then the user gets redirected to /Dibs/Dibs/success
which works without a problem. I've tried editing the callback-controller to just echo 1;
so that nothing is wrong with the code in the function.
Is there a way to never do a 302 redirect on /Dibs/Dibs/callback
or am I missing some configuration in Nginx or PHP that doesn't allow an external POST?
Worth mentioning might be that I'm using Vladgh´s installer script found here for NginX, MySQL, PHP (with APC and Suhosin) https://github.com/vladgh/VladGh.com-LEMP. I have this exact same setup on another server where the callback works just fine.