在Azure PHP Webrole上更改文档根目录 [英] Change document root on azure php webrole
问题描述
我想在azure webrole上安装Laravel框架,并且必须更改文档根目录,但是到目前为止,我仍然找不到方法来做到这一点
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
我的部署项目文件夹:
├──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
我发现了这个更改Windows Azure WebRole的approot路径,但是这是个很老的问题,没有经过批准的答案
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...
推荐答案
与Azure Cloud Service PHP WebRole目录中的一样,其中web.config
和web.cloud.config
文件用于在IIS上配置PHP站点应用程序.
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可以在这些文件中找到类似于以下内容的内容:
Web can find the content like the following in these files:
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="index.php" />
</files>
</defaultDocument>
</system.webServer>
我们可以修改设置defaultDocument
来更改laravel应用程序的文档根目录:
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>
这篇关于在Azure PHP Webrole上更改文档根目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!