npx serve正在提供主目录,而不是index.html

问题描述

我在Linux上运行的Web应用服务提供了一个React App,该应用的构建文件位于wwwroot中,使用运行npx serve的pm2进程提供:

ecosystem.config.js

module.exports = {
  apps: [
    {
      script: "npx serve -s",},],};

这很好用,直到服务开始随机提供整个/ home目录而不是wwwroot中的index.html文件。这就是浏览器中的网页现在的样子。

enter image description here

pm2进程似乎运行良好。

enter image description here

有什么想法吗?

解决方法

今天或本周末,有很多网站因同一问题而关闭。我有一张M $的票证可以理解为什么,但是我们可以通过使用Azure中的启动命令选项来临时修复。

App Service Configuration