When using Drupal 10.1 or above under Nginx+php-fpm, probably encounter 404 not found or too many redirects after enable CSS/JS aggregation.
This is actually caused by the nginx configuration, in your host config file, find the following line

location @rewrite {
rewrite ^/(.*)$ /index.php?q=$1;
}

and replace with

location @rewrite {
rewrite ^ /index.php;
}

Then reload your config file, the problem shall be solved.

Reference

https://www.drupal.org/project/drupal/issues/3368769