David
David

Reputation: 707

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 1App service

Please advise.

enter image description here

enter image description here

enter image description here

Upvotes: 2

Views: 2112

Answers (1)

suziki
suziki

Reputation: 14088

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.

enter image description here

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:

enter image description here

Upvotes: 3

Related Questions