简体   繁体   English

如何在Heroku上运行的Flask应用程序的/ blog Directoy上使用Wordpress

[英]How to have Wordpress on a /blog directoy of a Flask app running on Heroku

I have an app running on Heroku that use the domain example.com and a blog running on another host, Dreamhost, that uses the domain blog.example.com. 我有一个在Heroku上运行的应用程序,该应用程序使用域example.com,在另一个主机上运行的博客Dreamhost,该应用程序使用域blog.example.com。 For SEO purposes, I want to have the blog appear on example.com/blog. 出于SEO的目的,我希望该博客出现在example.com/blog上。 How could I achieve this? 我怎样才能做到这一点? My Googling powers have failed me, although it appears that using some Nginx rewrites could be the solution. 我的Google搜索功能使我失败了,尽管似乎可以使用一些Nginx重写来解决。 Any help is appreciated. 任何帮助表示赞赏。 Since it is for SEO purposes, I simple redirect won't do. 由于它是用于SEO的,因此我无法简单地进行重定向。 I found this solution: How can I use a subdirectory instead of a subdomain? 我找到了以下解决方案: 如何使用子目录而不是子域? , but is specific to Ruby on Rails. ,但特定于Ruby on Rails。

I am confused with what you are asking though, since Heroku a PaaS platform installing a webserver like nginx is not ease, i am guessing you may be using any nginx heroku buildpack with example.com pointing to nginx server in heroku, if these are correct then, 我对您的要求感到困惑,因为Heroku一个安装像nginx这样的网络服务器的PaaS平台并不容易,我猜您可能会在example.com使用任何nginx heroku buildpack指向heroku中的nginx服务器,如果这些正确的话然后,
creating a reverse proxy in nginx will route sites accessing example.com/blog to the address given 在Nginx中创建反向代理会将访问example.com/blog网站路由到给定的地址

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;
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM