Symfony Nginx Setup + Largon

  • | 3564 points

    I needed to adjust the Nginx setup slightly to get the default Symfony 3.2 route to work; specifically it was necessary to change this line (on line 7) in the

    index index.html index.htm index.php;

    index app_dev.php;

    Unfortunately I'm not too familiar with working directly with Symfony itself so I'm not sure if this is/was an upstream change but from what I can understand Symfony's default install will place the bootstrap / frontcontroller at:

    [the_webroot]/web/app.php or [the_webroot]/web/app_dev.php the subsequent location block is OK but if one navigates to:

    ...then one gets a 404 whereas one expects Symfony 3.2's default page.

    Can someone tell me if I'm doing something "odd"?


    (PS. The other way to "fix" this was to change app_dev.php or app.php to index.php but that seems a little kludgy).

  • administrators
    | 132054 points


    • If you want to change a Virtual Host, you must RENAME the file to: (no auto. prefix). Laragon will respect the content of the file and will not auto update it.
    • The other way is: creating index.php with reference to app.php, so you don't need to change.

  • administrators
    | 132054 points


    include_once __DIR__.'/app.php';

  • | 3564 points

    Personally I'd prefer a "require_once" because you really want the thing to go "die in a fire" if it can't find it.

    That said, is there a way to specify the template for the nginx (or apache) virtual hosts/configs so that one could do something like:

    • If they install Symfony 3, then the virtual host / nginx config looks like THIS
    • If they install David's Weird Frame, the the virtual host / nginx config looks like THAT

    (i.e. do all the quick installs share the same virtual host setup - and if not, is it possible to do something like the above?)

    (would something like the above be useful even?)

    [Pseudo code:

    1. If the quick setup does NOT specify a template config for the particular combination of web-server and quick setup, use the default;
    2. If it DOES though use that non-default one.


  • administrators
    | 132054 points

    @lloy0076: Doing IF is too specific. There are some ways but the easiest way is changing the generated Virtual Host.

    Another way is: if you are developing many projects related to a framework, just update the usr/tpl/Nginx.server.manifest

  • | 3564 points

    I have a suspicion my symfony woes are a symptom of something weirder - see which I think is somewhat related.

Log in to reply

Looks like your connection to Laragon was lost, please wait while we try to reconnect.