默认项目的伪静态是阿帕奇使用的,也就是web目录下的.htaccess文件;
nginx不回去读取这个配置文件的,所以要另外设置伪静态,
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
gii访问403是因为默认只允许本地访问,也就是127.0.0.1;
config/web.php中找到
$config['bootstrap'][] = 'gii';
$config['modules']['gii'] = [
'class' => 'yii\gii\Module',
// uncomment the following to add your IP if you are not connecting from localhost.
//'allowedIPs' => ['127.0.0.1', '::1'],
];
改成:
$config['bootstrap'][] = 'gii';
$config['modules']['gii'] = [
'class' => 'yii\gii\Module',
// uncomment the following to add your IP if you are not connecting from localhost.
'allowedIPs' => ['127.0.0.1', '::1','180.140.114.77'],
];
第五行去掉注释,在末尾加上自己电脑的ip地址即可
网友评论