2

我有一个使用 rails (unicorn) 和 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。有人可以指点我如何添加此子文件夹吗?

4

1 回答 1

1

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

于 2013-08-01T01:11:55.247 回答