Nginx下 Yii2.0 路由 --- urlManager 配置详解

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/DannyIsCoder/article/details/84617050

1.修改/usr/local/testWeb/frontend/config/main.php文件为:

[
    'components' => [
        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
            'enableStrictParsing' => false,
            'suffix' => '.html',
            'rules' => [
                // ...
            ],
        ],
    ],
]
2./ect/nginx/nginx.conf,修改配置:

   location / {

        #    root   /usr/local/nginx/html;

            root   /usr/local/testWeb/frontend/web;

            index  index.php index.html index.htm;

               if (!-e $request_filename){

                  rewrite ^/(.*) /index.php last;

               }

        }

3.

猜你喜欢

转载自blog.csdn.net/DannyIsCoder/article/details/84617050
今日推荐