gpt4 book ai didi

python - 如何在Heroku上运行的Flask应用程序的/blog目录中安装Wordpress

转载 作者:行者123 更新时间:2023-12-03 17:00:30 24 4
gpt4 key购买 nike

我有一个在Heroku上运行的应用程序,该应用程序使用域example.com;在另一个主机上运行的博客Dreamhost,该应用程序使用域blog.example.com。出于SEO的目的,我希望该博客出现在example.com/blog上。我怎样才能做到这一点?我的Google搜索能力使我失败了,尽管看起来使用一些Nginx重写可能是解决方案。任何帮助表示赞赏。由于它是用于SEO的,因此我无法简单地进行重定向。我找到了以下解决方案:How can I use a subdirectory instead of a subdomain?,但特定于Ruby on Rails。

最佳答案

我对您的要求感到困惑,因为Heroku一个安装像nginx这样的Web服务器的PaaS平台并不容易,我想您可能正在使用任何带example.com的nginx heroku buildpack,并且example.com/blog指向heroku中的nginx服务器,如果这些正确然后,
在Nginx中创建反向代理将把访问 的站点路由到给定的地址

server {
server_name example.com;
location /blog/{
proxy_pass blog.example.com; # expect request timeout from example.com -> this server
proxy_set_header Host $host; # or replace with blog.example.com
proxy_pass_request_headers on;
}
}

关于python - 如何在Heroku上运行的Flask应用程序的/blog目录中安装Wordpress,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41516900/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com