【问题标题】:WP migration from apache to nginx results -- 404 -- on httpsWP 从 apache 迁移到 nginx 结果 -- 404 -- on https
【发布时间】:2019-11-07 16:58:21
【问题描述】:

这是一个加载的标题。 我将我的网站从 Apache 转移到了 Nginx,我正在学习 Nginx 以自己的方式做事的艰难方式。它不喜欢 htaccess 文件,忽略它们。这在运行 Wordpress 时会导致问题,因为据说 wordpress 喜欢使用 htaccess 文件而 nginx 不喜欢。为什么?我不知道。

无论如何,

通过将此代码放在 nginx.conf 文件中,我设法弄清楚如何从 404 的深渊中恢复网站

location / {
        index index.php index.html;
        if (!-e $request_filename)
        {
                rewrite ^/(.+)$ /index.php last;
        }
}

但是。

虽然页面在 HTTP 上加载正常,但 HTTPS 仍然显示可怕的 404。为什么?我不知道。那么,有人知道下一步该怎么做吗?

【问题讨论】:

  • 试试:location / { try_files $uri $uri/ /index.php?$args; }

标签: wordpress nginx https http-status-code-404 nginx-config


【解决方案1】:

好吧,事实证明我还必须在 nginx.ssl.conf 文件中添加相同的代码。 为什么?我不知道,但它有效。

【讨论】:

    猜你喜欢
    • 2018-01-30
    • 2014-05-28
    • 2014-06-04
    • 2016-12-26
    • 1970-01-01
    • 1970-01-01
    • 2014-02-17
    • 2011-08-24
    • 1970-01-01
    相关资源
    最近更新 更多