使用nginx将Wordpress作为子文件夹添加到现有rails站点



我有一个正在运行的应用程序,它使用rails(unicon)和nginx。我的客户要求我将wordpress博客作为子文件夹移到现有服务器上。假设当前站点为www.example.com。博客链接应为www.example.com/blog我没有成功地将nginx配置为服务器wordpress博客。我目前的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。有人能告诉我如何添加这个子文件夹吗?

我认为你正在转发到@app,而它应该是@app_server_dinchi

最新更新