SubFolder WordPress Permalink not working on Nginx?

Open your terminal and login your server.

sudo nano /etc/nginx/sites-available/example.com

add location

        location /subfolder/ {
                try_files $uri $uri/ /subfolder/index.php?$args;
        }

and restart nginx

sudo service nginx restart