This article mainly introduces the relevant information about the solution to the 403 error when Yii accesses Gii (scaffolding). Friends in need can refer to it
The server was configured today (win server upupw(nginx mysql )), test the Gii settings of the project, and the result is a
#403 error page:
Error 403
You are not allowed to access this page.
1. Adjusted the read and write permissions of the file and accessed it through the domain name (external network access, local access), but still reported a 403 error.
2. Then access it locally on the server (http://localhost/backend/web/index.php?r=gii) and still get error 403.
3. According to the common solution on the Internet (query the local IP: 188.33.66.88), modify backend/config/main-local.php to add the access address:
$config['modules' ]['gii'] = [
'class' => 'yii\gii\Module',
'allowedIPs' => ['127.0.0.1', '::1','188.33. 66.88'],
];
Still not solved, still reporting 403 error.
Because the virtual host made by nginx is used locally and the domain name is directly bound for access, it is directly migrated to the local server, bound 127.0.0.1 and localhost, and then accesses http://localhost/backend/web/ locally again. index.php?r=gii, the gii management interface appears.
The above is the detailed content of Yii 403 error occurs when accessing Gii (scaffolding). For more information, please follow other related articles on the PHP Chinese website!