Change document root on azure php webrole

百般思念 提交于 2019-12-13 01:25:35

问题


I want setup Laravel framework on azure webrole and have to change document root, but so far I can't find way how to do this

My deployment project folder:

├──webrole <- now this is document root
│  ├──app
│  ├──bin
│  ├──bootstrap
│  ├──config
│  ├──database
│  ├──public <- I want make this as document root
│  ├──resources
│  ├──storage
│  ├──tests
│  ├──vendor
│  ├──.env
│  ├──.env.example
│  ├──.gitattributes
│  ├──.gitignore
│  ├──artisan
│  ├──composer.json
│  ├──composer.lock
│  ├──gulpfile.js
│  ├──package.json
│  ├──phpspec.yml
│  ├──phpunit.xml
│  ├──readme.md
│  ├──server.php
│  ├──Web.cloud.config
│  └──Web.config
├──deploymentSettings.json
├──ServiceConfiguration.Cloud.cscfg
├──ServiceConfiguration.Local.cscfg
├──ServiceDefinition.csdef

I found this Change approot path of Windows Azure WebRole but it's quite old question and there isn't approved answer

The only one workaround I've found is using rewrite rules but, I think that is not secure...


回答1:


As in Azure Cloud Service PHP WebRole directory, where are web.config and web.cloud.config files which is leveraged to configure PHP site application on IIS.

Web can find the content like the following in these files:

<system.webServer>
    <defaultDocument>
      <files>
        <clear />
        <add value="index.php" />
      </files>
    </defaultDocument>
  </system.webServer>

We can modify the setting defaultDocument to change the document root of your laravel application:

<system.webServer>
    <defaultDocument>
      <files>
        <clear />
        <add value="public/index.php" />
      </files>
    </defaultDocument>
  </system.webServer>


来源:https://stackoverflow.com/questions/35357846/change-document-root-on-azure-php-webrole

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