带有SSR的Angular 6部署在Azure上

时间:2019-11-12 09:28:50

标签: angular azure deployment angular6 server-side-rendering

如何在Azure上使用Server Side Render部署Angular 6应用程序? 构建 npm后,运行build:ssr

我有这个: enter image description here

我还将在下一行添加web.config:

<configuration>
<system.webServer>

    <handlers>
        <!-- indicates that the app.js file is a node.js application to be handled by the iisnode module -->
        <add name="iisnode" path="server.js" verb="*" modules="iisnode" />
    </handlers>
    <iisnode watchedFiles="web.config" nodeProcessCountPerApplication="0" />
    <rewrite>
        <rules>
            <!-- Don't interfere with requests for logs -->
            <rule name="LogFile" patternSyntax="ECMAScript" stopProcessing="true">
                <match url="^[a-zA-Z0-9_\-]+\.js\.logs\/\d+\.txt$" />
            </rule>

            <!-- Don't interfere with requests for node-inspector debugging -->
            <rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
                <match url="^server.js\/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{REQUEST_URI}" />
            </rule>

            <!-- All other URLs are mapped to the Node.js application entry point -->
            <rule name="DynamicContent">
                <conditions>
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True" />
                </conditions>
                <action type="Rewrite" url="server.js" />
            </rule>

            <rule name="Redirect to https" stopProcessing="true">
                <match url="(.*)" />
                <conditions>
                    <add input="{HTTPS}" pattern="off" ignoreCase="true" />
                </conditions>
                <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
            </rule>
            <rule name="AngularJS Routes" stopProcessing="true">
                <match url=".*" />
                <conditions logicalGrouping="MatchAll">
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                </conditions>
                <action type="Rewrite" url="/" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>

所以我只是发布它,并在我的WEB中出现错误: 由于发生内部服务器错误,因此无法显示该页面。

我也尝试在Azure中使用控制台,但是它也写错了 enter image description here

0 个答案:

没有答案