How to solve DirectAdmin NGINX: 404 not found

If you encounter issues when upgrading DirectAdmin from Apache to NGINX (especially with WordPress), this might be because the rewrite rules are configured incorrectly.

To easily solve this, copy the nginx_server.conf and nginx_secure_server.conf to the /usr/local/directadmin/data/templates/custom/ folder and add the following code to the template:

try_files $uri $uri/ /index.php?q=$uri&$args;

This should be put under the |CUSTOM| tag. After you’ve added the above code in the files, run the following code to rewrite your current NGINX configuration:

cd /usr/local/directadmin/custombuild
./build rewrite_confs

Your WordPress site and all the pages should load correctly now.

Leave a Reply

Your email address will not be published. Required fields are marked *