将Apollo服务器部署到IIS

时间:2020-05-07 20:30:33

标签: iis graphql apollo-server iisnode

我正在尝试使用IISNode将GraphQL服务器部署到IIS(不确定这是否是最好的方法)。

我使用了以下指南,但似乎仍然无法解决问题:

Installing IISNode

Deploying GraphQL Express

Official IISNode Docs

有人会提供有关如何执行此操作的分步说明吗,或者我可以通过其他途径共同托管我的GraphQL服务器?

最终目标是能够通过在设备浏览器应用程序上执行以下操作,从连接到本地网络的任何设备访问GraphQL Playground:

http://ip-of-server-hosting-graphql/graphql

1 个答案:

答案 0 :(得分:0)

您可以尝试使用iis反向代理模块将iis中的express js应用程序用于服务器。

首先,您需要在iis中安装URL重写和Application Request Routing扩展:

URL Rewrite

Application Request Routing

  • 现在打开iis并选择任何站点。

  • 双击中间窗格中的URL重写。

enter image description here

  • 添加新规则,然后选择反向代理模板。

enter image description here

  • 在系统提示时启用代理功能。

enter image description here

  • 在反向代理规则中添加您的node.js网站的地址,不要忘记添加端口。

enter image description here

  • 一旦添加了规则,反向代理配置就会起作用。

enter image description here

要继续运行您的节点js应用,您可以安装pm2:

npm install -g pm2

pm2 start app.js:启动我们的Node.js应用程序

pm2 stop:停止正在运行的进程

pm2 restart:重启正在运行的进程

pm2 list:列出所有正在运行的进程

参考链接:

https://techcommunity.microsoft.com/t5/iis-support-blog/setup-iis-with-url-rewrite-as-a-reverse-proxy-for-real-world/ba-p/846222

https://dev.to/petereysermans/hosting-a-node-js-application-on-windows-with-iis-as-reverse-proxy-397b

相关问题