Just installed CakePHP3 under nginx and tried to switch between pages of a paginated view and every time it would return the default 1st page.
The url for each page was
http://example.com/cake3/posts?page=2
Discovered using debug_kit that the GET request QUERY_STRING parameters weren't being sent to CakePHP. The query string is everything after the question mark in the URL. In other words page=2.
This was because nginx wasn't sending the query string to the PHP-FPM process.
But the fix:
document_root /var/www/html/domain.com; location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { expires 1d; #log_not_found off; rewrite ^/cake3(?!/webroot)(.+)$ /cake3/webroot$1? break; try_files $uri $uri/ =404; } location /cake3 { rewrite ^/cake3(?!/webroot)(.+)$ /cake3/webroot$1$is_args$args break; # put $is_args$args into the rewrite statement above try_files $uri $uri/ /cake3/index.php$is_args$query_string; } location ~ \.php$ { try_files $uri =404; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; fastcgi_index index.php; }
0 Comments