【问题标题】:Adding a Forum to my Nodejs Webapp向我的 Nodejs Web 应用程序添加论坛
【发布时间】:2017-08-02 21:48:23
【问题描述】:

我有一个 HapiJS Node Web 应用程序 example.com 目前正在运行。我希望在我的网站上添加一个论坛来建立一个社区,网址为 example.com/community

到目前为止,我已经查看了NodeBB。但是,它在自己的单独节点服务器上运行,我无法弄清楚如何将其定向到我的原始域(example.com)

【问题讨论】:

  • 仅供参考,我删除了不相关的 php 标签。您应该只添加 relevant 标签。

标签: node.js forum nodebb


【解决方案1】:

您需要使用像 nginx 这样的反向代理,以便将对 / 的请求发送到 HapiJS 应用程序,并将对 /community 的请求发送到 NodeBB。

nginx 配置中的相关部分

location / {
  .. do whatever
}

location /forum/ {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header Host $http_host;
    proxy_set_header X-NginX-Proxy true;

    proxy_pass http://127.0.0.1:4567;
    proxy_redirect off;

    # Socket.IO Support
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-22
    • 2020-02-09
    • 2014-02-18
    • 2014-07-31
    • 2012-03-13
    相关资源
    最近更新 更多