i'm facing a problem with nginx rewrites after i migrate my Magento website from Apache to Nginx! When i add a product to the cart and i press the button Place the order is giving me 500 internal server error ! I opened my logs and i can see this error message :
2017/05/26 13:03:39 [error] 48314#48314: *4022 could not find named location "@handler", client: 81.149.36.86, server: abcsports.co.uk, request: "GET /index.php/checkout/onepage/ HTTP/1.1", host: "www.....", referrer: "http://www........"
My conf file is looking like that :
Redirect to www.
server { listen 80; server_name abcsports.co.uk; return 301 $scheme://www.$host$request_uri; }
Set FPM pool socket for Magento Dashboard, based on adminhtml cookie
map $http_cookie $phpfpm_socket { default unix:/var/run/php-fpm/abcsports.co.uk.sock; ~adminhtml unix:/var/run/php-fpm/abcsports.co.uk-admin.sock; }
server { listen 80 default_server; server_name www.abcsports.co.uk media.abcsports.co.uk skin.abcsports.co.uk js.abcsports.co.uk; # root /var/www/vhosts/abcsports.co.uk/httpdocs; root /var/www/html/abcsports.co.uk/public_html/;
access_log /var/log/nginx/abcsports.co.uk-access.log; error_log /var/log/nginx/abcsports.co.uk-error.log;
client_body_buffer_size 8k; client_max_body_size 10M; client_header_buffer_size 1k; large_client_header_buffers 4 16k;
# SSL Termination if ($server_port = 80) { set $httpss off; } if ($http_x_forwarded_proto = https) { set $httpss on; }
location / { index index.html index.php; try_files $uri $uri/ @handler; expires 30d; }
location ~ ^/(app|includes|media/downloadable|pkginfo|report/config.xml|var)/ { deny all; }
location /. { return 404; }
location @handler { rewrite / /index.php; } #location ~ .php/ { rewrite ^(.*.php)/ last; }
location ~ .php$ { #if (!-e $request_filename) { rewrite / /index.php last; } expires off; fastcgi_pass $phpfpm_socket; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param MAGE_RUN_CODE default; fastcgi_param MAGE_RUN_TYPE store; fastcgi_param HTTPS $httpss; include fastcgi_params; fastcgi_buffer_size 32k; fastcgi_buffers 512 32k; fastcgi_read_timeout 300; } }
server { listen 443 ssl; server_name abcsports.co.uk www.abcsports.co.uk media.abcsports.co.uk skin.abcsports.co.uk js.abcsports.co.uk; root /var/www/html/abcsports.co.uk/public_html/; ssl on; ssl_certificate /etc/ssl/certs/abcsports.co.uk.pem; ssl_certificate_key /etc/ssl/certs/abcsports.co.uk.key;
access_log /var/log/nginx/abcsports.co.uk-ssl-access.log; error_log /var/log/nginx/abcsports.co.uk-ssl-error.log;
location / { index index.html index.php; try_files $uri $uri/ @handler; expires 30d; }
}
I looked everywhere on the internet and i read a lot of things but didn't find the solution ! I would appreciate any help ! Thank you !