Home >CMS Tutorial >WordPress >Detailed explanation of key configurations of WordPress non-root directory deployment nginx

Detailed explanation of key configurations of WordPress non-root directory deployment nginx

藏色散人
藏色散人forward
2021-03-26 17:11:202750browse

下面由WordPress教程栏目给大家介绍wordpress非根目录部署nginx关键配置方法,希望对需要的朋友有所帮助!

Detailed explanation of key configurations of WordPress non-root directory deployment nginx

wordpress非根目录部署nginx关键配置

在非根目录部署wordpress时/wp-json/wp/v2/posts这样的rest Api会访问不了

增加nginx配置(假设部署在wp文件夹下)

location /wp {  
    if (-f $request_filename/index.php) {  
        rewrite (.*) $1/index.php;  
    }  
    if (!-f $request_filename){  
        rewrite ^/wp/(.*)$ /wp/index.php;  
    }  
}

The above is the detailed content of Detailed explanation of key configurations of WordPress non-root directory deployment nginx. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete