Symfony 3 - 总是得到404错误

I am a beginner in Symfony 3.

I've installed it and when i go to http://localhost/Symfony/web/app_dev.php the page is displaying then there is a javascript confirm box with the message "An error occured while loading the web debug toolbar (404:Not Found). Do you want to open the profiler?"

Even if i go to http://localhost/Symfony/web/app_dev.php/test i have a 404 error page, but it is not the Symfony 404 page.

I am on Ubuntu and Nginx.

I have tried differents things but nothing were correct for me.

Could you give me a hand on that so I don't have this confirm box and can go to others pages ?

Thanks.

UPDATE: In the var/logs/dev.log i have this message :

[2017-07-18 11:00:39] request.INFO: Matched route "homepage". {"route":"homepage","route_parameters":{"_controller":"AppBundle\\Controller\\DefaultController::indexAction","_route":"homepage"},"request_uri":"http://localhost/Symfony/web/app_dev.php/","method":"GET"} []
[2017-07-18 11:00:39] security.INFO: Populated the TokenStorage with an anonymous Token. [] []

Edit :

I restart the install with the version 3.3.5

I did these line and it worked a little bit better :

sudo mkdir -p /usr/local/bin
sudo curl -LsS https://symfony.com/installer -o /usr/local/bin/symfony
sudo chmod a+x /usr/local/bin/symfony

I had to change the composer.json too with these lines :

"autoload": {
        "psr-4": {
            "": "src/"
        },

Here my nginx config :

server {
    listen 80 default_server;
    listen [::]:80 default_server;
    root /var/www/html;

    index index.html index.htm index.nginx-debian.html;

    server_name localhost;

    location / {
                try_files $uri $uri/ /index.php?$args /app.php$is_args$args;
    }

# start symfony
location ~ ^/(app_dev|config)\.php(/|$) {
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        fastcgi_param DOCUMENT_ROOT $realpath_root;
    }
# end symfony

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass 127.0.0.1:9000;
    }
}

But I still have the 404 error page for any pages, even for a bundle that I have generated.

Any ideas ?

First of all, point your site's root to the web folder. Not any of its parents. And check again.

For the debug toolbar, check your security.yml There should be a firewall dev that closes security for js, images etc

Something like

firewalls:
    # disables authentication for assets and the profiler, adapt it according to your needs
    dev:
        pattern: ^/(_(profiler|wdt)|css|images|js)/
        security: false

You can use php built-in Web Server. Is much easier and you don't need to have nginx configured for this.

using putty go to your project and start the web server

cd symfonyProject/
php bin/console server:start

You will see a message how to access the development server.

More details you find here http://symfony.com/doc/current/setup/built_in_web_server.html

Good luck.