【发布时间】: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;
}
【问题讨论】: