Assuming your the url for the project is https:://yourdomain.com/nested, then paste this code in your conf file. Remember to change nested to your real sub-directory folder name
location /nested { alias /var/www/nested/public; try_files $uri $uri/ @nested; location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_pass unix:/var/run/php/php8.2-fpm.sock; #change 8.2 to your php version } } location @nested { rewrite /nested/(.*)$ /nested/index.php?/ last; }