banner
李大仁博客

李大仁博客

天地虽大,但有一念向善,心存良知,虽凡夫俗子,皆可为圣贤。

[Wordpress] 在子目錄下建立WP網站的Nginx反向代理設定

子目錄下 WP 建站 Nginx 反向代理設置 參考官方文件,兩種方式以下都可以實現要求

方法 1,rewrite 方式,適用 php-fpm location /替換子目錄名稱/ { index index.html index.php; if (-f $request_filename/index.html){ rewrite (.*) $1/index.html break; } if (-f $request_filename/index.php){ rewrite (.*) $1/index.php; } if (!-f $request_filename){ rewrite (.*) /替換子目錄名稱/index.php; } } 方法 2,使用 try_files 方式 location /替換子目錄名稱/ { index index.php; try_files $uri $uri/ /替換子目錄名稱/index.php?$args; }

必須要做的,把 wp-admin 單獨處理 rewrite /替換子目錄名稱/wp-admin$ $scheme://$host$uri/ permanent;

載入中......
此文章數據所有權由區塊鏈加密技術和智能合約保障僅歸創作者所有。