Symfony project is not running on a remote virtual host because there is no index.php file in the project root directory. When I’m trying to open my symfony project on a localhost with
URL “localhost/symf.com”
it only shows me project folders instead of the home controller. I know I should open my site with Php bin/console server:start
command, but how does it work on a remote virtual host?
Perhaps I should somehow change my project’s root directory? But I don’t have access to remote virtual host configuration
2
Answers
Symfony’s homepage in at ‘YourProject/public/index.php’.
You have to point on this file to see your home controller.
In virtual host you must run
prod
environment notdev
as your localhost. So you must configure your Apache configuration to run your project. Use following link:Web Server Configuration for Symfony
Be careful, in symfony 3.4 the
DocumentRoot
is equal toproject_path/web
and in symfony 4.3 is equal toproject_path/public
You mentioned that you do not have access to your virtual host to set one by one configuration. In that case the best way is using
docker-compose
, so with runningdocker-compose up -d
all the things you need to run your project will be generated automatically. But you must have enough knowledge aboutdocker
Be successful.