I am very confused about how App Service works internally. I was exploring it and wanted to create a simple App Service through the portal to serve static files but only found a tutorial that uses a shell, not the Azure portal, that also requires services such as storage I don't need.
Here's what I've tried:
- Got a subscription and created a resource attached to the free trial subscription
- Create an App Service, basic (free) on Linux, using a new linux service plan and code (not container). I cannot choose any stack or runtime with only a static web server, so I select Node (LTS). I leave the startup command blank (later I'll expand on this). Http version 1.1 or 2 does not seem to make a difference. FTP enabled.
- The resource is properly created, I can see the typical hosting start web
- I connect to SFTP and I can see I have a path site/wwwroot with a single file
hostingstart.html
that looks exactly like the welcome page on the screenshot that I see when I access the website URL. I think to myself: "great! I can simply edit this html and I should see the result". Wrong. It does not seem to be the html being served. Not sure why it's there but if I remove it, I still see the same landing page on my site's URL. - I create an site/wwwroot/index.html but no luck. It's not being served. Maybe Node is not configured by default to do so.
- I create a simple server.js that is capable of serving statically any file: https://github.com/TheJaredWilcurt/NPM-Free-Server So I use FTP to place a site/wwwroot/server.js and I leave an index.html (in my localhost it works :) ).
- I configure in App Service a initial command like
node server.js
so that it can run and serve the page and I restart the server. Nothing, no effect. - I can see on the logs that my server.js is running. I can see a trace that says it's running on localhost:8000
At this stage it's been several hours investigating without luck. It can't be that hard! I find the following question surprisingly not answered: https://github.com/MicrosoftDocs/azure-docs/issues/32572#issuecomment-551053105
Could anybody shed some light on this? I am open to suggestions. My goal is: To have (only) an App Service serving a static index.html with a hello world created through the Portal.
Ta!
UPDATE 1: Thanks to https://stackoverflow.com/users/188096/gaurav-mantri for his suggestion. But I'd like to put emphasis on App Service being required as it's for training purposes and I'd like to go from very basic up to more complex dynamic app with the same service and continuous deployment.