安装完成yii后,配置好nginx。通过localhost:8212访问,正常.
美化前访问接口:http://127.0.0.1:8212/index.php?r=word/get-word-details&aid=12
现在:http://localhost:8212/frontend/word/get-word-details&aid=12
1、将web下的index.php入口文件复制到项目最外层。比如:basic/web/index.php => basic/index.php
2、在basic/下新建重写规则nginx_rewrite.conf文件。
内容为:rewrite ^/frontend/(.*)$ /?r=/$1&$query_string? last;
3、nginx配置文件增加重写规则:
location / {
index index.html index.htm index.php;
#系统用到的重写规则
include D:/project/basic/nginx_rewrite.conf;
}
即可。