尝试打开/app_dev.php时,Symfony 2:404未找到错误 [英] Symfony 2: 404 Not Found Error when tryes to open /app_dev.php

查看:232
本文介绍了尝试打开/app_dev.php时,Symfony 2:404未找到错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试打开时出现此错误消息

I am getting this error message when try to open

/app_dev.php

/app_dev.php

An error occurred while loading the web debug toolbar (404: Not Found).

Do you want to open the profiler?

当我单击确定"时,出现了以下错误:

When I click ok, I am getting then the error:

app_dev.php/_profiler/5053258a822e1

404 Not found

我正在使用nginx

I am using nginx

非常感谢您的帮助.

这是错误日志:

[error] 18369#0: *9 open() "/var/www/Symfony/web/app_dev.php/_wdt/5056f875afc98" failed (20: Not a directory), client: 127.0.0.1, server: symfony, request: "GET /app_dev.php/_wdt/5056f875afc98 HTTP/1.1", host: "symfony", referrer: "http://symfony/app_dev.php"
[error] 18369#0: *9 open() "/var/www/Symfony/web/404" failed (2: No such file or directory), client: 127.0.0.1, server: symfony, request: "GET /app_dev.php/_wdt/5056f875afc98 HTTP/1.1", host: "symfony", referrer: "http://symfony/app_dev.php"

当我尝试访问app_dev.php时,页面会打开,但没有工具栏;当我尝试使用app_dev.php/时,我会得到

When i try to access app_dev.php the page opens but without the toolbar and when I try with app_dev.php/ I am getting the

**Oops! An Error Occurred
The server returned a "404 Not Found".
Something is broken. Please e-mail us at [email] and let us know what you were doing when this error occurred. We will fix it as soon as possible. Sorry for any inconvenience caused. **

错误.

推荐答案

我知道这并不是您要问的,但可能会帮助将来搜索此问题的人(例如@yvoyer建议),我的问题也是斜杠,我的服务器使用了nginx和fpm,并且在nginx中//不能正常运行/,所以我不得不对虚拟主机conf进行一些修复,然后它可以正常工作.我只会将conf粘贴给需要它的人,或者建议一个更好的conf.

I know this isn't exactly what you asked but might help future people who search for this issue, like @yvoyer suggested, my issue was the trailing slash too, my server used nginx and fpm, and in nginx // does not euqal /, so i had to do a bit of fixes on my virtual host conf and it worked fine after that. I'll just paste the conf for whoever needs it, or suggests a better one.

    location / {
            try_files $uri @pass_to_symfony;
    }

    location ~ /app_dev.php/ {
            try_files $uri @pass_to_symfony_dev;
    }

    location @pass_to_symfony{
            rewrite ^ /app.php?$request_uri last;
    }

    location @pass_to_symfony_dev{
            rewrite ^ /app_dev.php?$request_uri last;
    }

    location ~ ^/app(_dev)?\.php($|/) {
            include fastcgi_params;
            fastcgi_pass   unix:/var/run/php5-fpm.sock; # replace with your sock path
    }

这篇关于尝试打开/app_dev.php时,Symfony 2:404未找到错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆