Open the file below, replacing “default” if necessary with the sites server block you want to do setting:
$ sudo vi /etc/nginx/sites-available/default
Replace:
try_files $uri $uri/ =404;
With:
try_files $uri $uri/ /index.php?$args;
If using a subfolder (say /wordpress), you’ll have to add an extra location /wordpress/ block to your configuration file :
location /wordpress/ { try_files $uri $uri/ /wordpress/index.php?$args; }
Finally, restart nginx:
$ sudo systemctl restart nginx
References:
https://www.digitalocean.com/community/questions/enabling-nginx-mod_rewrite
https://www.nginx.com/resources/wiki/start/topics/recipes/wordpress/
Leave a Reply