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

藏色散人
Release: 2021-03-26 17:11:20
forward
2746 people have browsed it

下面由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;  
    }  
}
Copy after login

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!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template