简体   繁体   中英

403 error when deploying Node.js website to Azure

I was following this article to deploy a simple node.js web app to Azure. Deplyment went fine - but when I visit the website - I get 403 You do not have permission to view this directory or page.

my node.js code:

var http = require('http')
var port = process.env.PORT || 1337;
http.createServer(function(req, res) {
  res.writeHead(200, { 'Content-Type': 'text/plain' });
  res.end('Hello from azure\n');
}).listen(port);

I think this might because of your directory structure. Maybe your server.js file was located in a sub folder of your git repository. Could you check the deployment log from azure portal (just click the down-arrow icon besides your recent deployment). It should tell you azure detected this is a node app. And in your case it might be not.

Alternatively you can login the azure website scm portal, just navigate to the url https://[your-site].scm.azurewebsites.net/ , and your can see the folder/files deployed and check the structure.

HTH

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