Nginx and WordPress custom permalink not working

SYSTEM INFORMATION
OS type and version Ubuntu 22.04
Webmin version 2.105
Virtualmin version 7.9.0

Just installed Virtualmin LEMP stack on ubuntu server and when i tried changing the permalink, it start showing error on other pages. i followed VirtualMin WordPress Nginx Permalinks 404 [Solved] - Nabtron and added this

  location / { 
        index index.php index.html index.htm; 
        try_files $uri $uri/ /index.php$is_args$args;
    }

However, it was mentioned that the settings will get wiped out with upgrade. How to keep it working? Why it is not being added natively with WordPress script installation?

Thanks

I was about to write the same thing. I use virtualmin with nginx for years and the only solution to that is to manually edit each site and add the above segment to nginx. I avoid to upgrade.

Tried using a new vps with almalinux 9 which seems to have less issues. However i don’t see separate .conf file path for each domain with this system

/etc/nginx/sites-available/

All i see a single nginx.conf which have the rules for domains. i can use above code which may work globally for all domains but what about the subfolders? this following code need to be added for each?

location / { 
        index index.php index.html index.htm; 
        try_files $uri $uri/ /wordpress/index.php$is_args$args;
    }

here /wordpress is the folder.
Remember that this modified nginx.conf will reset with the upgrade so that is the another issue.
wonder if the official devs help with this.

Hi buddy, the recent update with virtualmin script have the fix, could you check and confirm?

source: Nginx and WordPress custom permalink not working · Issue #2105 · webmin/webmin · GitHub

I’m sorry not checked yet cause busy of other jobs now. i will install from scratch on another server and test later.

Probably not useful here, but I just wanted to say, after working with nginx and wordpress I’ve gone back to apache. If you have additional users / sites Nginx becomes a pain in the ass. At least… for me it just caused problems and I got tired of workarounds.