samdark / yii2-cookbook

Yii 2.0 Community Cookbook
1.45k stars 297 forks source link

Configurations regarded for some popular web servers #145

Closed saidbakr closed 7 years ago

samdark commented 7 years ago

There's a guide page about it: http://www.yiiframework.com/doc-2.0/guide-start-installation.html#configuring-web-servers

saidbakr commented 7 years ago

@samdark The URL that you regarded is missing two major topics, IIS and filesystem security permissions for both Windows and Linux. Also there is no any mention about installing on shared host where there is only one public_html folder and it may host many sites or applications either under sub-domains or many domains which is requiring some modification for include functions in web/index.php

samdark commented 7 years ago

http://www.yiiframework.com/doc-2.0/guide-tutorial-shared-hosting.html

samdark commented 7 years ago

I don't have enough IIS experience to provide proper config.

saidbakr commented 7 years ago

The following is a sample of web.config file that I have used in Yii2 projects served on IIS, where the web folder is set to be the webroot folder of the website:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>

<directoryBrowse enabled="false" />

  <rewrite>
    <rules>
      <rule name="Hide Yii Index" stopProcessing="true">
        <match url="." ignoreCase="false" />
        <conditions>
        <add input="{REQUEST_FILENAME}" matchType="IsFile" 
              ignoreCase="false" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" 
              ignoreCase="false" negate="true" />
        </conditions>
        <action type="Rewrite" url="index.php" appendQueryString="true" />
      </rule> 
    </rules>
  </rewrite>
</system.webServer>
</configuration>

Checkout this reference

samdark commented 7 years ago

Won't merge it since it's empty.