如何在 url 路径而不是子域上托管 wordpress

时间:2021-02-09 18:09:05

标签: php wordpress apache nginx

您好,我们在我们的网站上托管了一个博客:https://blog.mergequeue.com,其中主应用程序使用 nginx https://mergequeue.com 托管在一个单独的盒子上

我们希望博客改为从 mergequeue.com/blog 呈现,但是当我在 Wordpress 和 Nginx 端设置配置时,这似乎不起作用。 Wordpress 使用标准的 buster docker 映像在单独的服务器上运行,该映像运行 apache + php。有没有人以前尝试过这个,在 nginx 和 Wordpress 端使用什么配置来完成这项工作?这是我尝试过的 nginx 配置:

server {
    listen         80;
    server_name    {{ domain_name }};
    if ($http_x_forwarded_proto = "http") {
      return 301 https://$server_name$request_uri;
    }
    location / {
        proxy_pass http://localhost:5000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
    location /static {
        alias /home/www/static;
    }
    location /blog {
      proxy_pass http://<wordpress_public_ip>:5000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

0 个答案:

没有答案