Change approot path of Windows Azure WebRole

2019-09-05 13:21发布

How is it possible to change the default approot path? E.g. I want to run a PHP Framework whose web root is a sub folder:

  symfony
  |_ app
  |_ bin
  |_ src
  |_ web <- Web root
      |_ index.php

The web root of the WebRole is there:

WebRole <- Web root
 |_ bin
 |_ php
 |_ resources
 |_ WindowsAzureSDKForPHP
 |_ diagnostics.wadcfg
 |_ Global.asax
 |_ Web.config
 |_ index.php
ServiceConfiguration.cscfg
ServiceDefinition.csdef

When bringing both togehter I get:

WebRole
 |_ bin
 |_ php
 |_ resources
 |_ WindowsAzureSDKForPHP
 |_ diagnostics.wadcfg
 |_ Global.asax
 |_ Web.config
 |_ symfony
      |_ app
      |_ bin
      |_ src
      |_ web <- Desired web root
          |_ index.php      
ServiceConfiguration.cscfg
ServiceDefinition.csdef

Is there a way to tell Windows Azure that the web root has changed? (The defaultDocument-setting in the Web.config is not enough).

Edit:

After the suggested changes of astaykov, the structure looks like this:

WebRole
 |_ ServiceConfiguration.cscfg
 |_ ServiceDefinition.csdef
 |_ symfony
      |_ app
      |_ bin
      |_ src
      |_ web <- Desired web root
         |_ bin
         |_ php
         |_ resources
         |_ WindowsAzureSDKForPHP
         |_ diagnostics.wadcfg
         |_ Global.asax
         |_ Web.config
         |_ index.php      

1条回答
太酷不给撩
2楼-- · 2019-09-05 14:12

Can you try adding it as another site. For example, add the folling site node to your service definition sites element:

 <Site name="symphony" physicalDirectory="../WebRole1/symphony/web">
        <Bindings>
          <Binding name="Endpoint1" endpointName="Endpoint1" hostHeader="www.symphony.com" />
        </Bindings>
  </Site>

You need to replace the "Endpoint1" and "www.symphony.com" with your actual endpoint name and host header. I tested it locally and it works (I tested with regular html files, but having php is not much different).

UPDATE Here is deployed sample:

http://sn.cloudapp.net/

http://symphony.staykov.net/

Please note that symphony.staykov.net is just a CNAME to sn.cloudapp.net.

However when deployed, both sites will reside each in its own subfolder of e:\sitesroot. Don't know if it will be an issue for you. How do you include the symphony files in your web? i.e. require_once('../symphony/something.php') ? This would not really work...

I will upload the sample scaffolded solution and provide a link later today or tomorrow.

UPDATE 2 - sources

You can check the scaffolded source here and the actual deploy package here to begin experimenting. Hope that it will give you some ideas on how to solve your issue.

查看更多
登录 后发表回答