I have a laravel project with Livewire Library installed, i have problems with query string parameter when i change from Apache to Nginx, the path is change to empty, in example the main path is http://example.com/active , when i use livewire for pagination it should http://example.com/active?page=1, but when i change the pagination to page 2 it change to http://example.com/?page=2 seems without path name, and when return to pagination page 1 the path is empty http://example.com/ but the page is still working.
I have No issue when using apache with standard config for laravel, but when i change to my production server and based to Nginx the path issues come up, but only in page that i’m using livewire library in page or for pagination, maybe people here have a same experience and problems, thanks in advance for any help.
Here my nginx config :
server {
listen 80;
server_name _;
root /var/www/project/public;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ .php$ {
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
}
}
2
Answers
This is the config I use all the time (for development using Docker Compose) and it works, try mine and see if it works, then start deleting stuff until it stops working again:
I think it might be the missing
include fastcgi_params;
orfastcgi_param PATH_INFO $fastcgi_path_info;
.Add this to your
nginx
config fileThis worked for me after a long period of trying.
You can remove the extensions you don`t need.