首页 文章

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

提问于
浏览
2

我有一个运行应用程序使用rails(独角兽)和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.有人能指出我如何添加这个子文件夹吗?

1 回答

  • 1

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

相关问题