【发布时间】:2014-01-30 06:40:33
【问题描述】:
我刚刚在 Debian 7.3 上下载了 Symfony 2.4.1 的新副本。
URL /Symfony/web/config.php 正确打开,但是当我继续配置时,我得到:
The requested URL /Symfony/web/app_dev.php/_configurator/ was not found on this server.
如果我绕过配置并打开 /Symfony/web/app_dev.php 页面显示,但弹出错误提示:
An error occurred while loading the web debug toolbar (404: Not Found)
Do you want to open the profiler?
如果我接受,我会得到:
The requested URL /Symfony/web/app_dev.php/_profiler/54a8bf was not found on this server.
在其他问题(例如Symfony 2: 404 Not Found Error when tryes to open /app_dev.php)中,人们建议摆弄 .htaccess 文件。 我什至尝试删除它,但它没有效果。
apache日志文件显示:
File does not exist: /var/www/Symfony/web/app_dev.php/_wdt/54a8bf, referer: http://wwwtest.di.unipi.it/Symfony/web/app_dev.php
File does not exist: /var/www/Symfony/web/app_dev.php/_profiler/54a8bf
所以看起来路由到任何内部 URL 都失败了,尽管正确的路由似乎已经到位:
> app/console router:debug
[router] Current routes
Name Method Scheme Host Path
_wdt ANY ANY ANY /_wdt/{token}
_profiler_home ANY ANY ANY /_profiler/
_configurator_home ANY ANY ANY /_configurator/
...
【问题讨论】:
-
找到了解决方案。必须将 AcceptPathInfo On 添加到 apache vhost 配置或 .htaccess 中。
-
请修正标题中的错字。 ;)
-
如果您找到了解决方案,您是否可以回答您自己的问题,以便其他人在寻找时更容易从答案中受益。
-
已解决,请在此处查看我的答案:stackoverflow.com/a/30313196/1700429
-
任何使用 nginx 的人,这对我有用:在 /etc/nginx/conf.d/default.conf 中替换 try_files $uri $uri/ /index.php?$args;通过 try_files $uri $uri/ /project-name/web/app_dev.php?$args;我自己在 ~/Projects/project-name 中有我的 symfony 项目,在 /usr/share/nginx/html/project-name 中有一个指向我的物理项目的符号链接。
标签: symfony configuration routing