Nginx returns 404 when enabling permalinks for a WordPress subfolder install

After we enable WordPress permalinks, we got 404 not found error.
Since we set up WordPress under a sub folder (/kb) with Nginx.
the correct config for Nginx is slightly different as below.
Note that we are using chroot nginx /html/ is the nginx webroot seen from the chroot.


location /kb {
root /html/;
index index.php index.html index.htm;
try_files $uri $uri/ /kb/index.php?q=$uri&$args;

location ~ .*\.php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

}
}

Leave a Reply

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

one + 7 =