【问题标题】:How to load subdomain under a path in the main website (NGINX)?如何在主网站(NGINX)的路径下加载子域?
【发布时间】:2021-04-09 03:58:08
【问题描述】:

我的 wordpress 博客在子域 (blog.example.com) 中运行,网站是在 example.com 上运行的反应应用程序。我想在有人导航到 example.com/blog 时加载博客。

(可能无关紧要,但只是额外的信息是,博客在 AWS Lightsail 内运行并直接在 Route53 中配置,网站在 EC2 内运行,nginx 为页面提供服务)

更新:

我仍然希望用户看到网址为example.com/blog/abc-def 不是 blog.example.com/abc-def。这可能吗?

【问题讨论】:

    标签: wordpress nginx react-router


    【解决方案1】:

    您可以使用 nginx 将 example.com/blog 重定向到 blog.example.com。

    location ^~ /blog {
        rewrite ^/blog/?(.*)$ https://blog.example.com/$1 permanent;
    }
    

    【讨论】:

    • 我仍然希望用户看到网址为example.com/blog/abc-def blog.example.com/abc-def。这可能吗?
    猜你喜欢
    • 2020-03-05
    • 2021-11-03
    • 1970-01-01
    • 2013-05-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-10
    • 1970-01-01
    相关资源
    最近更新 更多