【问题标题】:nginx 403 forbidden error for wordpress main pagewordpress主页的nginx 403禁止错误
【发布时间】:2020-02-09 21:25:01
【问题描述】:

我正在尝试使用 nginx 配置一个网站,该网站在主域上提供 django 并在 doamin.com/blog 上提供 wordpress,我的 django 部分工作得很好,但是在 wordpress 中我遇到了当我试图到达的问题wordpress 的主页 (domain.com/blog) 它给了我一个 403 nginx 禁止错误。其他一切都很好,例如我可以访问 wordpress 的仪表板并做所有事情。即使我尝试访问 domain.com/blog/xx 之类的 url,它也会在 wordpress 中正确显示一个(找不到页面)页面,这是正确的。 我唯一的问题是 domain.com/blog 所以因为我的问题只出在 wordpress 部分,所以我只复制了 nginx 配置

location /blog {
   alias /var/www/example.com;
   try_files $uri $uri/ @blog;

   location ~ \.php$ {
     try_files $uri =404;
     fastcgi_pass 127.0.0.1:9000;
     fastcgi_index index.php;
     fastcgi_param SCRIPT_FILENAME $request_filename;
     include fastcgi_params;
   }
}
location @blog {
  rewrite /blog/(.*)$ /blog/index.php?/$1 last;
}

【问题讨论】:

    标签: php wordpress nginx


    【解决方案1】:

    我刚刚从 try_files 中删除了 $uri/ 并且一切正常

    【讨论】:

      猜你喜欢
      • 2016-03-26
      • 2015-07-16
      • 2015-02-02
      • 1970-01-01
      • 2021-01-31
      • 1970-01-01
      • 2015-01-21
      • 2013-07-19
      相关资源
      最近更新 更多