Routing doesn`t work - Symfony app


I am trying to deploy my Symfony app to the Digital Ocean. The problem is with routing - the app cannot find my annotation routes in the Controller, so on requesting the response is default Symfony homepage.

My dev.log is :

request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException:                                                                                                       "No route found for "GET /"" at /var/www/coinwatch/vendor/symfony/http kernel/EventListener/RouterListener.php line 136                                                                                                                     {"exception":"[object (Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException(code: 0): No route found for \"GET /\" at /var/www/coinwatch/vendor/symfony/http-kernel/EventListener/RouterListener.php:136)\n                    [previous exception] [object] (Symfony\\Component\\Routing\\Exception\\NoConfigurationException(code: 0):  at /var/www/coinwatch/vendor/symfony/routing/Matcher/Dumper/CompiledUrlMatcherTrait.php:182)"} [] 

I have been following this guide

My source code (app is working correctly on my localhost) []

Here is my server block config file

server {
    listen 80;
    listen [::]:80;

    server_name coinwatch;
    root /var/www/coinwatch/public;
    index index.php;
    client_max_body_size 100m;

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

    location ~ \.php {
        try_files $uri /index.php =404;
        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param SCRIPT_NAME $fastcgi_script_name;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_index index.php;
        include fastcgi_params;

    location ~ /\.(?:ht|git|svn) {
        deny all;

On command

php bin/console debug:router 

it returns no routes

Thanks in advance.

Submit an answer
Answer a question...

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

Finally, I have fixed it. The problem was apparently in outdated composer packages. This command worked.

composer update --with-dependencies 

Initially, the previous command was failing because of lacking swapping memory. That was fixed by following commands.

/bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
/sbin/mkswap /var/swap.1
/sbin/swapon /var/swap.1

Since you say it works locally, my best guess would be a caching problem. Go and check /var/www/coinwatch/var/cache - does it have the proper permissions?

You can also try running bin/console cache:clear -vvv on the droplet and see what happens, perhaps the cache isn’t being generated properly.

Also check your codebase for hardcoded paths.

P.S. Why do you have a var/log folder inside public? Is that a custom thing, or is Symfony creating it? The var folder should generally be outside of public.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.