2016-04-25 64 views
0

我正在構建將在Ubuntu VM中運行nodejs應用程序的azure模板(https://github.com/kevinday/azure-quickstart-templates/blob/master/augur-on-ubuntu/azuredeploy.json)。在Azure中公開提供NodeJS應用程序

npm start 

[email protected] start /root/augur 
http-server ./build -c-1 -p $PORT 

Starting up http-server, serving ./build 
Available on: 
http://127.0.0.1:true 
http://10.0.0.4:true 
Hit CTRL-C to stop the server 

我想http流量暴露到我已配置,http://dnsname.eastus.cloudapp.azure.com DNS名稱。

我已經在門戶網站上看到過文檔建議配置和端點,但我不再看到這個選項。有人能指出我如何修改模板以正確配置此端點的方向嗎?

回答

0

您需要的網絡安全組中創建入站規則,以允許端口流量80

{ 
    "apiVersion": "[variables('apiVersion')]", 
    "type": "Microsoft.Network/networkSecurityGroups", 
    "name": "[variables('networkSecurityGroupName')]", 
    "location": "[resourceGroup().location]", 
    "properties": { 
    "securityRules": [ 
     { 
     "name": "httpRule", 
     "properties": { 
      "description": "httpRule", 
      "protocol": "Tcp", 
      "sourcePortRange": "*", 
      "destinationPortRange": "80", 
      "sourceAddressPrefix": "*", 
      "destinationAddressPrefix": "*", 
      "access": "Allow", 
      "priority": 110, 
      "direction": "Inbound" 
     } 
     } 
    ] 
    } 
} 

與核供應國集團和入站規則模板的完整樣本,請訪問:https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-security-group-create/azuredeploy.json

對於有關Azure網絡安全組的詳細信息,請參閱:https://azure.microsoft.com/en-us/documentation/articles/virtual-networks-nsg/

0

據我所知,您可以嘗試創建NSG-FrontEnd的web-rule以允許HTTP通信到FrontEnd子網。

請參閱文檔How to create NSGs using a template以瞭解如何使用ARM執行此操作。

這裏是一個示例ARM模板片段。

"apiVersion": "2015-06-15", 
"type": "Microsoft.Network/networkSecurityGroups", 
"name": "[parameters('frontEndNSGName')]", 
"location": "[resourceGroup().location]", 
"tags": { 
    "displayName": "NSG - Front End" 
}, 
"properties": { 
    "securityRules": [ 
    { 
     "name": "web-rule", 
     "properties": { 
     "description": "Allow WEB", 
     "protocol": "Tcp", 
     "sourcePortRange": "*", 
     "destinationPortRange": "80", 
     "sourceAddressPrefix": "Internet", 
     "destinationAddressPrefix": "*", 
     "access": "Allow", 
     "priority": 101, 
     "direction": "Inbound" 
     } 
    } 
    ] 
} 
相關問題