Q&A
hogeWPの下にfogaWPを置きたいのですが、うまく出来ません。
前提としてkusanagiを採用したWPで設定ファイル等はkusanagi provisionで作成されたものを変更しようとしています。
hogeWPもfogaWPも一度kusanagi provisionで作成しました。
以下の設定はfogaWPをサブディレクトリで表示する箇所のみの記述です。
前後にhogeWPの設定は記述しております。
こちらの記述を行うと/fogaWPでfogaWPのWPが確認できて、記事も見れるのですが、cssやjsが404になります。
location /fogaWP { alias /home/kusanagi/fogaWP/DocumentRoot; index index.php index.html index.htm; try_files $uri $uri/ /fogaWP/index.php?$args; if (!-e $request_filename) { rewrite ^/fogaWP(.+)$ /fogaWP/index.php?q=$1 last; break; } } location ~ ^/fogaWP/.+.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_split_path_info ^/fogaWP(.+.php)(.*)$; fastcgi_param SCRIPT_FILENAME /home/kusanagi/fogaWP/DocumentRoot$fastcgi_script_name; fastcgi_intercept_errors on; include fastcgi_params; }
こちらの記述を行うとcss等は反映されてデザインは問題なのですが、記事を見るとhogeWPの404のページが表示されます。(具体的には「記事が見つかりません」というページになります。おそらくWP標準の404ページだと思います。)
location ^~ /fogaWP { alias /home/kusanagi/fogaWP/DocumentRoot; index index.php index.html index.htm; try_files $uri $uri/ /fogaWP/index.php?$args; location ~ .php$ { include fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $request_filename; } }
css等も反映されて、記事ページも閲覧出来るnginxの設定をお教えいただければ幸いです。
宜しくお願い致します。
参照サイト
https://qiita.com/pochy9n/items/e613f66c391219da21ae
https://joppot.info/2016/04/05/3107