Deploying into Azure Web App web root with Azure DevOps task “Azure App Service Deploy” v3

独自空忆成欢 提交于 2020-07-07 06:44:30

问题


I'm using Azure DevOps with the "Azure App Service Deploy" task (AzureRmWebAppDeployment@3) to deploy to an Azure Web Site and am having trouble deploying to the web root.

The application is PHP and has a "public" folder which is designed to be the only folder to be exposed publicly. The folder structure is like this:

/
  application/
  vendor/
  public/
    index.php
    favicon.ico
    images/
    etc...

When I configure Azure App Service Deploy task with the "Virtual application" setting to "" (as in blank), it actually appears to default to the "/" virtual application.

This is problematic as the default application ("/") should be pointing to /sites/wwwroot/public/ such that the index file is at /sites/wwwroot/public/index.php.

What happens in this setup is that the deploy task appears to default to "/" when the "Virtual application" setting is left blank, which results in deploying to /sites/wwwroot/public so that my index file is at /sites/www/root/public/public/index.php (which would be accessible on the web at https://app.azurewebsites.net/public/index.php)

How can I deploy the application to the web root /sites/wwwroot/ such that my index file is located at /sites/wwwroot/public/index.php on disk?


Azure DevOps


App Service


回答1:


Yes, that configuration for pointing to "Public" from Virtual Application and directories is the correct process: By default, App Service directs web requests to the root directory of your app code. For example, Laravel starts in the public subdirectory. If you wish to access your app would be accessible at http://example-site.com/public, but you would really want to direct http://example-site.com to the public directory instead. Ensure that the default document( index.php) is appropriatey set.

  -<action type=”Rewrite” url=”index.php” appendQueryString=”true” />

So go into your public folder, create a web.config file with this line - If the configuration is all done, just to narrow down the issue and if feasible try to restart the app and see if that helps.




回答2:


I know this is a late reply.. but i found a solution for this. In your Webapp, configure a virtual application and point it to site\wwwroot and then in the azure pipeline when you configure the task for Azure App Service Deploy, set the virtual application in there. I have tested and it works.

J



来源:https://stackoverflow.com/questions/55250240/deploying-into-azure-web-app-web-root-with-azure-devops-task-azure-app-service

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!