Blog by Daniel Hauck. Sysadmin, Developer, Blogger.

Hurray! This is for now the last part of this tutorial series. Today we will install symfony. Or better said, we will install the symfony installer.

And we will extend our nginx template a bit. If you remember, we just pointed the nginx root to /vagrant/. As we all of course know, symfony want’s the docroot at /vagrant/web/. So we will make this a bit more flexible.

Symfony Installer

Oh man, this is nearly boring… But automation should make it boring, so that you can focus on the cool fun stuff in live 😉

Create your role:

You can get the installer like free candy via curl from Open up provisioning/roles/symfony/tasks/main.yml:

and make it executalbe:

Give our nginx role flexibility

For now we could run any php application like wordpress from the /vagrant/ directory. We should keep it like this. But when we want to run symfony, we need some extras.

Since we cannot create our symfony application in the /vagrant/ directory, since it’s not empty, we need to use another doc root in nginx and slightly customize the try_files and the location directive.

Open up provisioning/roles/nginx/templates/server.j2 and first go to line 3 and change it to:

then take a look at try_files and change it to match the following:

and the location:

Meanwhile I saw that I don’t added the handler to the “render nginx sites” task in provisioning/roles/nginx/tasks/main.yml. So just append:

Of course we need to add the type variable in our group_vars/all:

And that’s it. Now let’s save you file, add the role ‘symfony’ to your playbook.yml.

And you are done.


Ok, now let’s try the whole chain again.

Let’s see if everything goes right. And bam!

Now let’s see if we can create a symfony project with the exectuable:

If you remember right, we could adjust the app name easily in group_vars/all. We could call it anything, but let’s stick with symfony for now.

So this could take a while, get yourself some beer or so 😉
If you get this screen, you are ready to go:

Let’s see if our setup works!

End Boss Browser

Ok, I am excited! If we now point our Browser to and get the symfony default page, everything works. Do it! Click it 😉

Ouh, well what??

If you get this message, you did everything right! That means symfony is working! It’s just a security mechanism to not allow anyone outside access your development environment. But now we want to access the symfony development app from outside, so we can get rid of this!

Sadly there isn’t a parameter for this in symfony, so we just delete a few lines.

Therefore open symfony/web/app_dev.php and delete the complete if block:

Reload your browser and baaaaaaaaaaam!

Symfony Greeting
If you get the default controller and the debug toolbar, you did everything right!

There are no comments.

Leave a Reply