Symfony2 -尝试在prod环境中查看我的站点,结果是一个空白屏幕;在dev没有错误/警告

时间:2022-04-09 23:02:00

Cross-posted from the official Symfony Google Group because time is an issue:

来自Symfony谷歌集团的交叉贴子,因为时间是个问题:

I'm in the final push to upload my site to my host. Everything runs fine in the dev environment - no errors, no warnings. When I attempt to access it in prod (localhost/web/app.php/), I get a blank screen. I attempted to clear the cache, to see if that would help, but got the following error:

我正在把我的网站上传到我的主机。在开发环境中一切运行良好——没有错误,没有警告。当我尝试在prod (localhost/web/app.php/)中访问它时,会得到一个空白屏幕。我试图清除缓存,看看这是否有用,但得到以下错误:

$ app/console cache:clear --env=prod

[Symfony\Component\DependencyInjection\Exception\InvalidArgumentException] 
The parameter "kernel.trusted_proxies" must be defined. 

I can clear the dev cache without issue.

我可以毫无问题地清除dev缓存。

Please help.

请帮助。

1 个解决方案

#1


16  

You'll need to add trusted_proxies to your config, even if it is blank.

您需要将trusted_proxy添加到配置中,即使它是空的。

Within: app/config/config.yml add:

内:app / config / config。yml:添加

framework:
    trusted_proxies: ~

You'll also likely want to delete your cache files (app/cache/prod) and then run your console cache clear ($ app/console cache:clear --env=prod)

您可能还想删除缓存文件(app/cache/prod),然后运行控制台缓存清理($ app/console缓存:clear——env=prod)

#1


16  

You'll need to add trusted_proxies to your config, even if it is blank.

您需要将trusted_proxy添加到配置中,即使它是空的。

Within: app/config/config.yml add:

内:app / config / config。yml:添加

framework:
    trusted_proxies: ~

You'll also likely want to delete your cache files (app/cache/prod) and then run your console cache clear ($ app/console cache:clear --env=prod)

您可能还想删除缓存文件(app/cache/prod),然后运行控制台缓存清理($ app/console缓存:clear——env=prod)