如何在Plesk共享Windows服务器中部署Angle Universal

时间:2018-12-04 16:54:30

标签: angular angular6 plesk angular-universal

在生产中,我正在Angular 6中实现Angular Universal Rendering,而Angular Universal在本地计算机上工作,我可以轻松地部署和运行它。但是,当我开始在Plesk共享Windows服务器中部署Angular Universal时,它无法正常工作。我点击了几个链接,但是信息很少。请在如何在Plesk共享Windows服务器中部署Angular Universal Rendering方面需要一些帮助。感谢您的帮助!谢谢! 这是我的步骤:

  1. 我这样部署:

       npm run build:ssr && npm run serve:ssr
    
  2. 我使用以下结构在主机上上传dist文件夹:

    --root
       --dist(folder)
          --Kabook-Web(folder)
             --server.js
          --Kabook-Web-Server(folder)
       --web.config
       --package.json
    
  3. 然后我在服务器上启用了Node.js并运行NPM安装。安装后,将返回以下警告。

       NPM install
       npm notice created a lockfile as package-lock.json. You should commit this file.
       npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
       npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
    

我不确定它们是否重要?

  1. 我在web.config中复制了以下代码

       <handlers>
       <add name="iisnode" path="dist/Kabook-Web/server.js" verb="*" modules="iisnode" />
       </handlers>
    
       <rewrite>
       <rules>
       <rule name="myapp">
       <match url="/*" />
       <action type="Rewrite" url="dist/Kabook-Web/server.js" />
       </rule>
       <!-- Don't interfere with requests for node-inspector debugging -->
       <rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
       <match url="^dist/Kabook-Web/server.js\/debug[\/]?" />
       </rule>
    
       </rules>
    
       </rewrite>
    
       <directoryBrowse enabled="true" />
    
       <iisnode devErrorsEnabled="true" debuggingEnabled="true" loggingEnabled="true" nodeProcessCommandLine="C:\Program Files\nodejs\node.exe" />
    
  2. 然后我将以下代码复制到server.js中,如此链接Plesk Windows deploy node.js

    中所述
       app.use(express.static('dist/Kabook-Web'));
    

然后我运行我的网站,并在资源管理器中遇到此错误。

       iisnode encountered an error when processing the request.

       HRESULT: 0x2
       HTTP status: 500
       HTTP subStatus: 1002
       HTTP reason: Internal Server Error
       You are receiving this HTTP 200 response because system.webServer/iisnode/@devErrorsEnabled configuration setting is 'true'.

       In addition to the log of stdout and stderr of the node.exe process, consider using debugging and ETW traces to further diagnose the problem.

       The node.exe process has not written any information to stderr or iisnode was unable
       to capture this information. Frequent reason is that the iisnode module is unable 
       to create a log file to capture stdout and stderr output from node.exe. 
       Please check that the identity of the IIS application pool running the node.js 
       application has read and write access permissions to the directory on the server 
       where the node.js application is located. Alternatively you can disable logging 
       by setting system.webServer/iisnode/@loggingEnabled element of web.config to 'false'.

我不知道该怎么解决。拜托,有人帮我...

0 个答案:

没有答案