You just flipped the web server switch in your Webuzo VPS panel from Apache to Nginx, expecting a performance boost. Instead, every custom permalink, slug, and sub-path on your website collapses into a wall of 404 Not Found: The requested URL was not found on this server.
When you transition an environment managed by Webuzo to Nginx, existing URL routing rules that relied on Apache do not translate out of the box. Nginx processes requested URIs directly against the disk. Without an explicit fallback mechanism to pass unhandled slugs back to your application handler, Nginx throws an immediate 404 error.
Fixing this routing failure requires injecting a single directive block into the shared Nginx configuration file on your server.
Targeting the Nginx Common Configuration
To resolve the issue across your domains on the server, you need to append a fallback routing block directly inside the central common configuration file.
Connect to your VPS environment via SSH using a terminal emulator like PuTTY, or open a connection using an SFTP client. The target file is located at:
bash/usr/local/apps/nginx/etc/conf.d/common
Modifying files in this directory requires administrative privileges. If you are not operating as root, prefix your commands with sudo.
To edit the file with Vim:
bashsudo vim /usr/local/apps/nginx/etc/conf.d/common
Inside Vim, hit the i key to switch into insert mode.
If you prefer Nano, run:
bashsudo nano /usr/local/apps/nginx/etc/conf.d/common
Injecting the URI Fallback Directive
Navigate directly to the very end of the file. Do not edit, modify, or delete any existing lines already present in the configuration.
Append the following location block to the bottom of the file:
nginxlocation / { try_files $uri $uri/ /index.php?q=$request_uri; }
This directive tells Nginx to evaluate the requested URI in a specific sequence:
$uri: Check if a static file matching the exact URI exists.$uri/: Check if a directory matching the URI exists./index.php?q=$request_uri: If neither a file nor a directory exists, route the entire request string to/index.phpas a query parameter (q=$request_uri).
Saving Changes and Reloading Nginx
Once the configuration block is appended to the bottom of the file, save your changes and exit your editor.
For Vim:
- Press the
Esckey to exit insert mode. - Type
:wq!and hit Enter to write the file and quit.
For Nano:
- Press
Ctrl-X. - Press
yto confirm saving the buffer, then hit Enter.
The changes will not take effect until Nginx reloads its configuration. You can apply the new setup using either the command line or the Webuzo graphical control panel.
Method 1: Command Line Restart
Run the following service command in your terminal:
bashservice nginx restart
Method 2: Webuzo Panel Interface
If you prefer managing services via the browser interface:
- Log in to your Webuzo panel.
- Navigate to the Services menu.
- Locate nginx in the service list.
- Click the reload/refresh icon.
Once the Nginx service reloads, all custom slugs and URLs on your website will resolve normally without throwing 404 errors.
