0

I created a Full Stack application using Next.js with Typescript, and deployed it successfully to Azure Web Apps using GitHub, however when I try to access the website I got the message "You do not have permission to view this directory or page.".

I already run "npm run build" and test the application locally to make sure everything is working, I also verified the Default documents to include index.js, index.tsx, index.html, and there are not IP restrictions or authentication requirements. The Virtual Path is set to / and the physical path is set to site\wwwroot. I tried adding a web.config file with details about serving the website (as I understand there is not need for this file, but I tried), but it didn't work either, I got the same message. Then I start over and deployed it from VS Code to see what happens, but I got the same error. I already checked the files in Azure Web App console and all files are there. I do not know what else to try, I really need help.

KUDU Console site folder

wwwroot folder

error on Log Stream

Default documents in Configuration

galler
  • 1
  • 1

1 Answers1

0

You do not have permission to view this directory or page.

This error occurs if there is any missing files/ misconfiguration.

Check if the below steps help to fix your issue:

  • Try accessing your website by adding / to the URL/default domain. i.e., https://pravuwebapp.azurewebsites.net/

  • Check if all the files of your application deployed properly. This can be checked in App Service=>Advanced Tools=>Kudu Site=>Debug Console=>CMD.

enter image description here

  • Make sure your files are deployed to wwwroot/ folder.
  • Add the settings SCM_DO_BUILD_DURING_DEPLOYMENT=true and WEBSITES_PORT=<port_number_of_your_application> in App Service=>Settings=>Configuration=>Add New Application Settings.
  • Go to App service=> Monitoring=> App Service Logs=> Select Filesystem.

enter image description here

  • Now you will be able to figure out the exact cause in the error logs in Logstream.

  • And also, you can check the error logs in Diagonostic settings of App service.

  • If this doesn't help, try deploying your application to Linux web app.

References:

SO1, SO2

Pravallika KV
  • 2,415
  • 2
  • 2
  • 7
  • 1
    Hello Pravallika, I did everything you mentioned, but it's still not working. I created a simple test application and deployed in Azure Web Apps to try, and it doesn't work either. I posted some images in the original post so you can guide me about what else I can try. – galler Jul 12 '23 at 04:28
  • Can you check if you have `web.config` in the deployed files under `site/wwwroot`? – Pravallika KV Jul 13 '23 at 06:13
  • I checked and I do not have it, neither server.js nor app.js. Since it is a Next app, do I need a web.config file? – galler Jul 14 '23 at 13:35
  • Refer the [SO](https://stackoverflow.com/questions/54908662/unable-to-deploy-next-js-to-azure/54942593#) solutions which may help to fix your issue. – Pravallika KV Jul 14 '23 at 15:40