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

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.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章