node.js - 如何在 Azure 上部署 Strapi CLI 应用程序
问题描述
我刚刚在本地机器上启动了新的 Strapi 项目,并将其保存在 bitbucket 存储库中。所以我需要在 Windows 环境中部署它 Azure。我已经在免费层的基础上成功部署了 Postgres,现在是一个节点 Web 应用程序,我在 web.config 规则和部署方面遇到了问题
我尝试在自定义 web.config 周围搜索以重定向所有请求/public
。
<?xml version="1.0" encoding="utf-8"?>
<!--
This configuration file is required if iisnode is used to run node processes behind
IIS or IIS Express. For more information, visit:
https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config
-->
<configuration>
<system.webServer>
<!-- Visit http://blogs.msdn.com/b/windowsazure/archive/2013/11/14/introduction-to-websockets-on-windows-azure-web-sites.aspx for more information on WebSocket support -->
<webSocket enabled="false" />
<handlers>
<!-- Indicates that the server.js file is a node.js site to be handled by the iisnode module -->
<add name="iisnode" path="{NodeStartFile}" verb="*" modules="iisnode"/>
</handlers>
<rewrite>
<rules>
<!-- Do not interfere with requests for node-inspector debugging -->
<rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
<match url="^{NodeStartFile}\/debug[\/]?" />
</rule>
<!-- First we consider whether the incoming URL matches a physical file in the /public folder -->
<rule name="StaticContent">
<action type="Rewrite" url="public{PATH_INFO}"/>
</rule>
<rule name="Static Assets" stopProcessing="true">
<match url="([\S]+[.](html|htm|svg|js|css|png|gif|jpg|jpeg))" />
<action type="Rewrite" url="build/{R:1}"/>
</rule>
<rule name="Index" stopProcessing="true">
<match url="^$" />
<action type="Rewrite" url="public/index.html"/>
</rule>
<!-- All other URLs are mapped to the node.js site entry point -->
<rule name="DynamicContent">
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
</conditions>
<action type="Rewrite" url="{NodeStartFile}"/>
</rule>
</rules>
</rewrite>
<!-- Make sure error responses are left untouched -->
<httpErrors existingResponse="PassThrough" />
</system.webServer>
</configuration>
显然这不满足 Strapi 路由要求。相反,我收到 500 内部路由错误。如何在可以访问我的管理面板和 api 的地方正确设置它?如何自定义我deploy.cmd
的来做strapi build
?在 Azure 上部署的正确方法是什么?
我还在这里为他们记录了一个问题到它的文档中
解决方案
推荐阅读
- flutter - 实现 authstatechanges 后调用两次的类
- curl - curl 命令使用其票证 ID 获取 jira 票证的数据
- asp.net-core - EF Core 5.0 RC1 表架构
- javascript - 在 API 获取期间总是收到此 CORS 错误
- datastage - IBM DataStage:日期时间溢出
- command-line-interface - IBM Cloud Functions:如何定位组织和空间/命名空间
- laravel - 在 Laravel 中有多个 groupBy 日期?
- javascript - 如何使用 FETCH 请求获取多个文件?
- python - 如何选择名称中包含指定单词的列并且它们的值等于databricks上的hive sql中的指定值
- java - 为什么我在 Java Spring 中收到“没有映射 GET /css/main.css”?