2014-04-21 193 views
1

我最近部署了一个symfony项目,并注意到开发环境仍然可以访问。Symfony - 在开发环境中无法访问开发环境

以下网址加载项目的督促下版本:

http://domain.com/app.php/index

以下网址加载该项目的开发版本:

http://domain.com/app_dev.php/index

我想知道,如果它是在产品环境中可能无法访问该项目的开发版本?

我感谢任何意见,提前致谢!

+3

简单的方法是删除'app_dev.php'。 –

+0

感谢您的回复。那肯定很简单!但是,当我导航到app_dev.php时,我得到一个内部服务器错误,而不是页面未找到错误。 – AnchovyLegend

+1

刚删除'app_dev.php',然后清除缓存'$ php app/console cache:clear --env = prod --no-debug' – falsecrypt

回答

0

添加以下代码行的app_dev.php

// this check prevents access to debug front controllers that are deployed by accident to  production servers. 
// feel free to remove this, extend it, or make something more sophisticated. 
if (!in_array(@$_SERVER['REMOTE_ADDR'], array(
              '127.0.0.1', 
              '::1',))) 
{ 
    header('HTTP/1.0 403 Forbidden'); 
    exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.'); 
}