1

I already have next.js application running as Azure Web Service with the structure below:

current working example

But I cannot find any information which folders is required exactly. Deploying to Vercel is out of scope because main requirement is to use Azure Web Applications. My project using server-side rendering so the folder ".next" has been created with next build command and looks like this

next build

next export is out of scope too because of SSR.

Questions are:

  1. In addition to the .next folder which folders and files do I need also?
  2. Should I have "server.js" in the site root because redirect rule and iisnode behavior are set in the web.config?
  3. Can I deploy only .next folder? If yes how server will start in Azure Web App service?

Thank you!

SouXin
  • 1,565
  • 11
  • 17

1 Answers1

-1

Firstly, the web.config is required on Windows environment. Simply put, the web.config file is an XML file that IIS used for your site configuration.

About the file structure, you could use next export to generate an out folder.

enter image description here

And deploy only out folder to KuDu, and add the start command in the Configurations on Portal:

pm2 serve /home/site/wwwroot --no-daemon --spa

enter image description here

Please have a look at these articles:

  1. Configuring & Optimizing your Node.js app in an Azure App Service
  2. https://stackoverflow.com/a/61835649/13586071
Doris Lv
  • 3,083
  • 1
  • 5
  • 14
  • As I already said `export` cannot be used because site is using server side rendering. But thank you for the command. Will try. – SouXin May 31 '21 at 10:13