yii2 gii Forbidden (#403)解决方案
2015-10-23 17:47
1056 查看
原文章来自
it技术擎
Forbidden (#403)
You are not allowed to access this page.
The above error occurred while the Web server was processing your request.
Please contact us if you think this is a server error. Thank you.
如果出到以上的错误,请确认你的配置是否是正确的。
$config['bootstrap'][] = 'debug';
$config['modules']['debug'] = 'yii\debug\Module';
$config['bootstrap'][] = 'gii';
$config['modules']['gii'] = array('class'=>'yii\gii\Module',
原始 的配置是这样的,如果你的 使用的是本地的服务器的话,则不会存在问题。
如果你使用的是服务器的问题,就会出现以上的错误提示了
详细分析得知,是Gii做了默认IP限定了
源代码如下:
namespace yii\gii;
use Yii;
use yii\base\BootstrapInterface;
use yii\web\ForbiddenHttpException;
class Module extends \yii\base\Module implements BootstrapInterface
{
public $controllerNamespace = 'yii\gii\controllers';
public $allowedIPs = ['127.0.0.1', '::1'];
。。。。。。
源代码做了限定了 只允许 127.0.0.1是可以访问的其他都是不行的。
所以解决以上的问题
需要修改配置如下:
$config['bootstrap'][] = 'debug';
$config['modules']['debug'] = 'yii\debug\Module';
$config['bootstrap'][] = 'gii';
$config['modules']['gii'] = array('class'=>'yii\gii\Module',
'allowedIPs' => ['127.0.0.1', '::1', '192.168.*.*', '192.168.178.20'],
);
这样在 allowedIPs 数组里面的IP全部可以访问了
it技术擎
Forbidden (#403)
You are not allowed to access this page.
The above error occurred while the Web server was processing your request.
Please contact us if you think this is a server error. Thank you.
如果出到以上的错误,请确认你的配置是否是正确的。
$config['bootstrap'][] = 'debug';
$config['modules']['debug'] = 'yii\debug\Module';
$config['bootstrap'][] = 'gii';
$config['modules']['gii'] = array('class'=>'yii\gii\Module',
原始 的配置是这样的,如果你的 使用的是本地的服务器的话,则不会存在问题。
如果你使用的是服务器的问题,就会出现以上的错误提示了
详细分析得知,是Gii做了默认IP限定了
源代码如下:
namespace yii\gii;
use Yii;
use yii\base\BootstrapInterface;
use yii\web\ForbiddenHttpException;
class Module extends \yii\base\Module implements BootstrapInterface
{
public $controllerNamespace = 'yii\gii\controllers';
public $allowedIPs = ['127.0.0.1', '::1'];
。。。。。。
源代码做了限定了 只允许 127.0.0.1是可以访问的其他都是不行的。
所以解决以上的问题
需要修改配置如下:
$config['bootstrap'][] = 'debug';
$config['modules']['debug'] = 'yii\debug\Module';
$config['bootstrap'][] = 'gii';
$config['modules']['gii'] = array('class'=>'yii\gii\Module',
'allowedIPs' => ['127.0.0.1', '::1', '192.168.*.*', '192.168.178.20'],
);
这样在 allowedIPs 数组里面的IP全部可以访问了
相关文章推荐
- php+sqlrelay+mysql实现连接池及读写负载均衡
- PHP开源项目使用Travis CI进行持续集成
- PHP,Mysql-根据一个给定经纬度的点,进行附近地点查询
- php里面的变量从哪里来?
- thinkphp集成nusoap
- excel导入数据的时间格式问题
- php无法连接mysql报错但命令行下可以连接Warning: mysql_connect(): Access denied for
- php,phpexcel插件导出excel使用
- 通过js的console优雅的将php调试信息输出
- 【php】文字转图片
- php 学习笔记--bool
- FreeBSD中配置FTP
- 关于PHPExcel
- php项目域名绑定和替换
- PHP多进程处理并行处理任务实例
- 关于php中laravel框架的学习--适合菜鸟初学者
- 解决ftp不支持软连接
- [php]mail函数发送邮件
- Mod4-PHP编码规范
- PHP框架CodeIgniter入门使用(2)