简体   繁体   中英

Failed to deploy React app (build) folder to App Service Azure

I'm following this link below on how to deploy React app to App Service Azure. How to deploy React app to App service Azure

However, I couldn't see my application page but the Azure App service default page. "Hey, Node developers!"

Here, I have attached screenshots about the deployment condition and logs. [App service 1 应用服务

Please advise.

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

Update:

Another method:

The premise of this method is you have Node.js env and have installed npm tools.

1.add a file name index.js under the site/wwwroot.

index.js:

var express = require('express');
var server = express();
var options = {
index: 'index.html'                                             //Fill path here.
};
server.use('/', express.static('/home/site/wwwroot', options));
server.listen(process.env.PORT);

2.install express:

run this command under the wwwroot directory,

npm install -save express

3.restart your app service and wait for minutes.


Original Answer:

First of all, you can follow this link to know how to deploy your react app to azure.

https://medium.com/microsoftazure/deploying-create-react-app-as-a-static-site-on-azure-dd1330b215a5

All of the files will be upload to D:/site/wwwroot, the physical folder.

Default page setting of the web app based on Linux os is very similar.

在此处输入图片说明

For example, I have a file named index.php under public_html folder and I want to set it as the default page of my web app.

You need to create a file named .htaccess under the wwwroot.

This is the content of the .htaccess file:

DirectoryIndex public_html/index.php

Then, Success set the default page:

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM