我刚刚在本地计算机上启动了新的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上部署的正确方法是什么?
我还在这里为他们记录了一个问题,有关他们的文档