yii2 advanced installation

install composer
Use domestic mirror
Install composer-asset-plugin
install yii
 
 
composer config -g repo.packagist composer https://packagist.phpcomposer.com
composer global require "fxp/composer-asset-plugin"
composer create-project --prefer-dist yiisoft/yii2-app-advanced yii-application
cd yii-application
php init
Modify the database configuration in common/config/main-local.php
'dsn' => 'mysql:host=localhost;dbname=yii2advanced',
php open extension
extension=pdo_mysql
Create database yii2advanced in mysql
yii migrate
Set the web server frontend root directory yii-application/frontend/web/
Backend root directory yii-application/backend/web/
 
Set URL beautification
Add the following to the web.config file in the root directory
 
        <rewrite>
            <rules>
                <rule name="yii" stopProcessing="true">
                    <match url="^(.*)$" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{HTTP_HOST}" pattern="^(.*)$" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php/{R:1}" />
                </rule>
            </rules>
        </rewrite>
 
 
反注释main.php中的urlManager片断
重启iis

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326491700&siteId=291194637