Switching your VPS web server from Apache to Nginx via the Webuzo panel often breaks custom permalinks. You’ll hit a 404 Not Found error (The requested URL was not found on this server) the moment you try accessing a post via its slug.
The culprit? Nginx doesn’t read .htaccess files. It doesn't know how to handle WordPress (or generic PHP) rewrite rules out of the box. You have to teach it.
Here is the pragmatic fix.
The Fix: Inject the try_files Directive
You need to edit the global Nginx common configuration file.
1. Access the Config File
SSH into your VPS as root (or use sudo). Open the common config:
bashvim /usr/local/apps/nginx/etc/conf.d/common
Prefer Nano? Swap vim for nano. If permission denied, prefix with sudo.
2. Append the Snippet Scroll to the very bottom of the file. Do not edit existing blocks. Paste this clean block at the end:
nginxlocation / { try_files $uri $uri/ /index.php?q=$request_uri; }
What this does: It tells Nginx: "Try the exact file ($uri), then try the directory ($uri/), and if both fail, hand off to index.php with the query args intact." This replicates the standard WordPress/Apache rewrite logic.
3. Save & Exit
- Vim: Press
Esc, type:wq!, hitEnter. - Nano: Press
Ctrl+X, hitY, thenEnter.
4. Reload Nginx
Apply the changes immediately.
Via CLI:
bashservice nginx restart
Via Webuzo GUI: Navigate to Services → Find Nginx → Click the Reload/Refresh icon.
Result
Your custom slugs/URLs should now resolve perfectly. No more 404s on pretty permalinks.
