After switching a WordPress website to FPM served by nginx in Plesk, it fails to load with “404 Not Found” on all pages except start page

After switching a WordPress website to FPM served by nginx in Plesk, it fails to load with “404 Not Found” on all pages except start page.

See: https://support.plesk.com/hc/en-us/articles/213912945-A-WordPress-website-on-a-Plesk-server-shows-404-Not-Found-on-all-pages-except-index-php-when-running-on-FPM-by-nginx

For one website

In Plesk, add the content below to the Additional nginx directives field of the WordPress domain at Domains > example.com > Apache & nginx Settings:


    if (!-e $request_filename) {
    set $test P;
    }
    if ($uri !~ ^/(plesk-stat|webstat|webstat-ssl|ftpstat|anon_ftpstat|awstats-icon|internal-nginx-static-location)) {
    set $test "${test}C";
    }
    if ($test = PC) {
    rewrite ^/(.*)$ /index.php?$1;
    }


Leave a Comment