[symfony-users] Re: Configure a virtual host to access multiple symfony projects
As far as I know, hosts file does not support wildcard domains. What you are doing is correct. Pablo On Fri, Sep 18, 2009 at 3:48 AM, Davide Borsatto wrote: > > Hi everybody, > > Lately I've been doing many experiments with symfony, creating > differents projects for each of them. > I usually create an apache dedicated virtual host, with a defined > server name, link to the web/ directory of symfony, and add a row to > the /etc/hosts file to match the new server name. > > I'm sure this is not the best way to achieve the result... > > Indeed, I was thinking that it would be cool to reach multiple symfony > projects with url like > > http://project1.localhost/ > http://project2.localhost/ > > Where Apache understands that project1 is a directory, and builds the > path like this > > /var/www/symfony_projects/:project/web > > So I could simply create a new directory with a symfony project > inside, and it would be ready to go. > > My point is: is there any way to configure Apache to make this happen? > And the file /etc/hosts supports "wildcard hosts"? > > I'm a PHP programmer, and I'm not familiar with the Apache > configuration. I simply copy and paste the virtual host file and > change a few things to match this or that directory. > > > I'd really love to set up Apache this way, hope you guys can help. > Thanks! > > > -- Pablo Godel ServerGrove Networks http://servergrove.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: Configure a virtual host to access multiple symfony projects
you can also have a look at http://www.sfblog.fr/page/symfony-et-les-vhost-dynamique it's in french but the apache configuration should be enough to understand. On Sep 19, 3:55 am, kp wrote: > Sounds like what you are doing is correct, and it's the way I do it > (for local machine development). I create a separate vhost for each > Symfony site, tweak the paths, and add an entry to my hosts file. > > If each each project has a lib/vendor/symfony folder you can run > different versions of Symfony on your machine. > > You can also create separate vhosts for each of your apps within a > project. Create sub-directories under /web for each app, move the > front controller files into them, along with the css and images > folders or any other assets, and then tweak your vhost paths. > > example: > > > > ServerAdmin y...@example.com > ServerName local.site > > DocumentRoot /var/www/project/web/frontend > > DirectoryIndex index.php > > Alias /sf "/var/www/project/lib/vendor/symfony/data/web/sf" > > ErrorDocument 400 /index.php/errors/error404 > ErrorDocument 401 /index.php/errors/error404 > ErrorDocument 403 /index.php/errors/error404 > ErrorDocument 404 /index.php/errors/error404 > > > AllowOverride All > Allow from All > > > > AllowOverride All > Allow from All > > > > > Or if your apps share a lot of the same assets, keep all your common > files under /web and create aliases that point to them like this: > > Alias /css "/var/www/project/web/css" > Alias /images "/var/www/project/web/images" > > Kris > > On Sep 18, 3:48 am, Davide Borsatto wrote: > > > Hi everybody, > > > Lately I've been doing many experiments with symfony, creating > > differents projects for each of them. > > I usually create an apache dedicated virtual host, with a defined > > server name, link to the web/ directory of symfony, and add a row to > > the /etc/hosts file to match the new server name. > > > I'm sure this is not the best way to achieve the result... > > > Indeed, I was thinking that it would be cool to reach multiple symfony > > projects with url like > > >http://project1.localhost/http://project2.localhost/ > > > Where Apache understands that project1 is a directory, and builds the > > path like this > > > /var/www/symfony_projects/:project/web > > > So I could simply create a new directory with a symfony project > > inside, and it would be ready to go. > > > My point is: is there any way to configure Apache to make this happen? > > And the file /etc/hosts supports "wildcard hosts"? > > > I'm a PHP programmer, and I'm not familiar with the Apache > > configuration. I simply copy and paste the virtual host file and > > change a few things to match this or that directory. > > > I'd really love to set up Apache this way, hope you guys can help. > > Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: Configure a virtual host to access multiple symfony projects
Sounds like what you are doing is correct, and it's the way I do it (for local machine development). I create a separate vhost for each Symfony site, tweak the paths, and add an entry to my hosts file. If each each project has a lib/vendor/symfony folder you can run different versions of Symfony on your machine. You can also create separate vhosts for each of your apps within a project. Create sub-directories under /web for each app, move the front controller files into them, along with the css and images folders or any other assets, and then tweak your vhost paths. example: ServerAdmin y...@example.com ServerName local.site DocumentRoot/var/www/project/web/frontend DirectoryIndex index.php Alias /sf "/var/www/project/lib/vendor/symfony/data/web/sf" ErrorDocument 400 /index.php/errors/error404 ErrorDocument 401 /index.php/errors/error404 ErrorDocument 403 /index.php/errors/error404 ErrorDocument 404 /index.php/errors/error404 AllowOverride All Allow from All AllowOverride All Allow from All Or if your apps share a lot of the same assets, keep all your common files under /web and create aliases that point to them like this: Alias /css "/var/www/project/web/css" Alias /images "/var/www/project/web/images" Kris On Sep 18, 3:48 am, Davide Borsatto wrote: > Hi everybody, > > Lately I've been doing many experiments with symfony, creating > differents projects for each of them. > I usually create an apache dedicated virtual host, with a defined > server name, link to the web/ directory of symfony, and add a row to > the /etc/hosts file to match the new server name. > > I'm sure this is not the best way to achieve the result... > > Indeed, I was thinking that it would be cool to reach multiple symfony > projects with url like > > http://project1.localhost/http://project2.localhost/ > > Where Apache understands that project1 is a directory, and builds the > path like this > > /var/www/symfony_projects/:project/web > > So I could simply create a new directory with a symfony project > inside, and it would be ready to go. > > My point is: is there any way to configure Apache to make this happen? > And the file /etc/hosts supports "wildcard hosts"? > > I'm a PHP programmer, and I'm not familiar with the Apache > configuration. I simply copy and paste the virtual host file and > change a few things to match this or that directory. > > I'd really love to set up Apache this way, hope you guys can help. > Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: Configure a virtual host to access multiple symfony projects
On Fri, 18 Sep 2009, Davide Borsatto wrote: > Lately I've been doing many experiments with symfony, creating > differents projects for each of them. > I usually create an apache dedicated virtual host, with a defined > server name, link to the web/ directory of symfony, and add a row to > the /etc/hosts file to match the new server name. Another way to go is to have all your apps in one symfony tree and use multiple controllers, each in a separate folder (each controller points to the same tree but sets a different application). We have been using this technique to migrate an old site (static files) piece-by-piece by building the app and simply dropping an index.php file in the folder after the app is built and tested. This doesn't require any special modules or Apache voodoo :-) -- --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: Configure a virtual host to access multiple symfony projects
Seems like what I need, I'll check the docs later. Thanks anyway for the suggestion On Sep 18, 10:05 am, noel guilbert wrote: > Hi, > > You should look about the apache module "mod_vhost_alias" > :http://httpd.apache.org/docs/2.0/mod/mod_vhost_alias.html > > > > On Fri, Sep 18, 2009 at 9:48 AM, Davide Borsatto wrote: > > > Hi everybody, > > > Lately I've been doing many experiments with symfony, creating > > differents projects for each of them. > > I usually create an apache dedicated virtual host, with a defined > > server name, link to the web/ directory of symfony, and add a row to > > the /etc/hosts file to match the new server name. > > > I'm sure this is not the best way to achieve the result... > > > Indeed, I was thinking that it would be cool to reach multiple symfony > > projects with url like > > >http://project1.localhost/ > >http://project2.localhost/ > > > Where Apache understands that project1 is a directory, and builds the > > path like this > > > /var/www/symfony_projects/:project/web > > > So I could simply create a new directory with a symfony project > > inside, and it would be ready to go. > > > My point is: is there any way to configure Apache to make this happen? > > And the file /etc/hosts supports "wildcard hosts"? > > > I'm a PHP programmer, and I'm not familiar with the Apache > > configuration. I simply copy and paste the virtual host file and > > change a few things to match this or that directory. > > > I'd really love to set up Apache this way, hope you guys can help. > > Thanks! > > -- > Noël > GUILBERThttp://www.noelguilbert.com/http://www.sensiolabs.comhttp://www.symfony-project.com > Sensio Labs > Tél: +33 1 40 99 80 80 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: Configure a virtual host to access multiple symfony projects
Hi, You should look about the apache module "mod_vhost_alias" : http://httpd.apache.org/docs/2.0/mod/mod_vhost_alias.html On Fri, Sep 18, 2009 at 9:48 AM, Davide Borsatto wrote: > > Hi everybody, > > Lately I've been doing many experiments with symfony, creating > differents projects for each of them. > I usually create an apache dedicated virtual host, with a defined > server name, link to the web/ directory of symfony, and add a row to > the /etc/hosts file to match the new server name. > > I'm sure this is not the best way to achieve the result... > > Indeed, I was thinking that it would be cool to reach multiple symfony > projects with url like > > http://project1.localhost/ > http://project2.localhost/ > > Where Apache understands that project1 is a directory, and builds the > path like this > > /var/www/symfony_projects/:project/web > > So I could simply create a new directory with a symfony project > inside, and it would be ready to go. > > My point is: is there any way to configure Apache to make this happen? > And the file /etc/hosts supports "wildcard hosts"? > > I'm a PHP programmer, and I'm not familiar with the Apache > configuration. I simply copy and paste the virtual host file and > change a few things to match this or that directory. > > > I'd really love to set up Apache this way, hope you guys can help. > Thanks! > > > -- Noël GUILBERT http://www.noelguilbert.com/ http://www.sensiolabs.com http://www.symfony-project.com Sensio Labs Tél: +33 1 40 99 80 80 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---