Rails (unicorn) と nginx を使用して実行中のアプリがあります。クライアントから、WordPress ブログを既存のサーバーにサブフォルダーとして移動するように依頼されました。現在のサイトが www.example.com であるとします。ブログのリンクは www.example.com/blog である必要があります。nginx をワードプレス ブログ サーバーに設定できません。私の現在のnginx構成は次のとおりです。
upstream app_server_dinchi {
server unix:/tmp/.sock fail_timeout=0;
}
server {
listen 80;
server_name example.com www.example.com;
keepalive_timeout 5;
root /home/ubuntu/websites/example_staging/current/public;
try_files $uri/index.html $uri.html $uri @app;
location @app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app_server_dinchi;
}
#blog configuration
location /blog {
root /home/ubuntu/websites/blog.example.com;
index index.php;
}
location ~ /blog/.+\.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME /home/ubuntu/websites/blog.example.com$fastcgi_script_name;
}
location ~* \.(js|css|png|jpg|gif)$ {
if ($query_string ~ "^[0-9]+$") {
expires max;
break;
}
}
error_page 500 502 503 504 /500.html;
location = /500.html {
root /home/ubuntu/websites/example_staging/current/public;
}
}
example.com/blog にアクセスしようとすると 404 が表示されます。このサブフォルダーを追加する方法を誰か教えてもらえますか?