[英]access nodejs https app on Azure websites
I deployed my nodejs https server on Azure 我在Azure上部署了NodeJS https服务器
https.createServer(options, app).listen(8080, ()=>{console.log("listening on 8080")}); https.createServer(options,app).listen(8080,()=> {console.log(“正在监听8080”)});;
As you can see from the code snippet above it is listening on port 8080 从上面的代码片段可以看到,它正在侦听端口8080
How should i access my server on Azure websites? 我应该如何访问Azure网站上的服务器?
https://myapp.azurewebsites.net/ or https://myapp.azurewebsites.net:8080/ https://myapp.azurewebsites.net/或https://myapp.azurewebsites.net:8080/
Before giving the answer, here are some important concepts you should know about Azure Web App. 在给出答案之前,您需要了解一些有关Azure Web App的重要概念。
So you are supposed to use process.env.PORT
instead of 8080
and access your site with the url https://myapp.azurewebsites.net
. 因此,您应该使用process.env.PORT
而不是8080
并使用URL https://myapp.azurewebsites.net
访问您的站点。 You can see the pipe if you output it in log. 如果您在日志中输出管道,则可以看到它。
More details about Azure Web App sandbox . 有关Azure Web App沙箱的更多详细信息。
Besides, you can refer to this nodejs web app deploy tutorial and this app sample . 此外,您可以参考此nodejs Web应用程序部署教程和此应用程序样本 。
ok i found https://docs.microsoft.com/en-gb/azure/cloud-services/cloud-services-configure-ssl-certificate-portal 好的,我找到了https://docs.microsoft.com/en-gb/azure/cloud-services/cloud-services-configure-ssl-certificate-portal
it seems that azure handles https 似乎azure处理https
so there is no need for 所以没有必要
https.createServer(options, app).listen(8080, ()=>{console.log("listening on 8080")}); https.createServer(options,app).listen(8080,()=> {console.log(“正在监听8080”)});;
just the standard 只是标准
app.listen(process.env.port) app.listen(process.env.port)
process.env.port is the azure provided port process.env.port是Azure提供的端口
also to set to use https only (that is all incoming http gets redirected to https) refer to 也可以设置为仅使用https(即所有传入的http都重定向到https)是指
https://blogs.msdn.microsoft.com/benjaminperkins/2017/11/30/how-to-make-an-azure-app-service-https-only/ https://blogs.msdn.microsoft.com/benjaminperkins/2017/11/30/how-to-make-an-azure-app-service-https-only/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.