Question
Routing doesn`t work - Symfony app
Hi,
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 http://104.248.16.246/ 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 https://www.digitalocean.com/community/tutorials/how-to-deploy-a-symfony-4-application-to-production-with-lemp-on-ubuntu-18-04
My source code (app is working correctly on my localhost) [https://github.com/holesa/coinWatch]
Here is my server block config file
server {
listen 80;
listen [::]:80;
server_name coinwatch 104.248.16.246;
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.
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.
×