Permalink error on WP site in subdirectory

I recently shifted a couple of my wordpress sites that were installed under a sub directory of my main domain on my hostgator shared hosting server.

My main domain is also a wordpress site and I have all these other wordpress sites installed inside this domain in their own separate folders

I used the duplicator plugin to move sites from my shared hosting to Digital Ocean VPS hosting.

I did not have any caching option enabled for these blogs.

All the shifting went well and when I go to the subdirectory home page, it opens well. When I visit the individual page or post of these blogs, I get an 404 error. I know it is a permalink issue so I went back and changed the permalinks to default and all started working fine. However my ‘Pretty Link’ plugin stopped working saying I need to set my permalinks to anything except default. And I need this plugin badly to track links.

So I searched this forum and I followed the instructions given on the below link.

When I add the following lines in the /etc/nginx/sites-available/ file it gives me error and every blog page that I visit is downloaded to computer instead of displaying as a webpage:

set $dir “”; if ($request_uri ~ ^/([^/])/.$ ) { set $dir1 /$1; }

It’s worth mentioning that I don’t have the following lines in /etc/nginx/sites-available/

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

instead I have

include common/php.conf; include common/locations.conf;

Can you please help me fix this issue? I have tried every option possible without any success. Thanks so much.