【问题标题】:Change document root on azure php webrole在 azure php webrole 上更改文档根目录
【发布时间】:2016-05-23 07:43:42
【问题描述】:

我想在 azure webrole 上设置 Laravel 框架,并且必须更改文档根目录,但到目前为止我找不到如何做到这一点

我的部署项目文件夹:

├──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

我找到了这个Change approot path of Windows Azure WebRole,但这是一个很老的问题,没有得到批准的答案

我发现的唯一一种解决方法是使用重写规则,但我认为这并不安全...

【问题讨论】:

    标签: php laravel azure webrole


    【解决方案1】:

    在 Azure 云服务 PHP WebRole 目录中,web.configweb.cloud.config 文件用于在 IIS 上配置 PHP 站点应用程序。

    Web 可以在这些文件中找到如下内容:

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

    我们可以修改defaultDocument的设置来改变你的laravel应用的文档根目录:

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

    【讨论】:

    • 这种解决方法可能适用于某些 php 应用程序但不适用于 Laravel,Laravel 需要重写规则才能工作,无论如何使用我已经使用过的重写规则的一种解决方法,但现在我想更改文档根目录跨度>
    • 你使用的是哪个 laravel 版本?当我使用 laravel 4 进行测试时,它在本地或 Azure 云服务上都运行良好。
    • 我使用的是 Laravel 5.1
    • 你测试了什么?通过这种方式(没有重写模块)我认为路由模块不起作用......
    • 我刚刚跟着azure.microsoft.com/en-us/documentation/articles/…创建了PHP云服务,并创建了一个webrole。我将一个laravel 4应用程序复制到webrole目录,并修改web.configweb.cloud.config,并发布到azure。浏览云服务端点检查是否可以运行
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-11-30
    • 2017-08-31
    • 2012-04-26
    • 2014-02-23
    • 2016-06-21
    • 2017-06-25
    • 2011-05-06
    相关资源
    最近更新 更多