Development

HowtoMultipleSFProjectsLocal (diff)

You must first sign up to be able to contribute.

Changes between Version 5 and Version 6 of HowtoMultipleSFProjectsLocal

Show
Ignore:
Author:
phoeffl (IP: 91.36.244.105)
Timestamp:
12/06/08 10:37:48 (9 years ago)
Comment:

Added chapter for mass-virtual-hosting.

Legend:

Unmodified
Added
Removed
Modified
  • HowtoMultipleSFProjectsLocal

    v5 v6  
    4444 
    4545After restarting Apache now we can access our projects with 
     46 
    4647  * http://askeet 
    4748  * http://phpmyadmin 
    4849  * http://anotherproject 
    4950 
     51 
     52 
     53== Extended Solution == 
     54 
     55If you have a lot of projects sharing the same host configuration, there is an even easier way to access them. 
     56Apache can be configured for something called [http://httpd.apache.org/docs/2.0/en/vhosts/mass.html Dynamically Configured Mass Virtual Hosting]. 
     57 
     58  * Create the directory {{{/home/me/public_html/sym}}} 
     59  * Like described above create a new vhost file and include it. 
     60  * Be sure that {{{log_config_module}}} is loaded. 
     61 
     62 
     63This is my file {{{vhost.sym.conf}}}: 
     64 
     65{{{ 
     66 
     67# ### 
     68# Configuration file for mass hosting 
     69# 
     70 
     71LogFormat "%V %h %l %u %t \"%r\" %s %b" symcommon 
     72 
     73NameVirtualHost 127.0.0.4:80 
     74Listen          127.0.0.4:80 
     75 
     76<VirtualHost 127.0.0.4:80> 
     77  VirtualDocumentRoot   "/home/me/public_html/sym/%1/web" 
     78  CustomLog             "logs/sym.access_log" symcommon 
     79  ErrorLog              "logs/sym.error_log" 
     80   
     81  <Directory "/home/me/public_html/sym/*/web"> 
     82    AllowOverride All 
     83    Allow from All 
     84  </Directory> 
     85   
     86  DirectoryIndex index.php 
     87   
     88  Alias /sf /$data_dir/symfony/web/sf 
     89 <Directory "/$data_dir/symfony/web/sf"> 
     90   AllowOverride All 
     91   Allow from All 
     92 </Directory> 
     93  
     94</VirtualHost> 
     95 
     96}}} 
     97   
     98 
     99As you can see, this is almost the same configuration as above. 
     100The main difference is the use of [http://httpd.apache.org/docs/2.0/en/mod/mod_vhost_alias.html#virtualdocumentroot VirtualDocumentRoot] to locate the document root. 
     101 
     102Restart your Apache to load the configuration. Remeber that you can use {{{httpd -S}}} to let Apache show he settings parsed from the configuration files. 
     103 
     104Now you can set up new projects '''without restarting apache'''. 
     105The only manual step left is configuring your {{{/etc/hosts}}} for name resolution. 
     106 
     107 
     108For testing we will set up two projects: 
     109 
     110Change to the {{{/home/me/public_html/sym/}}} directory. This is the root for the new projects. 
     111{{{ 
     112   mkdir first 
     113   cd first 
     114   symfony generate:project first 
     115   symfony generate:app frontend 
     116    
     117   cd .. 
     118   mkdir second 
     119   cd second 
     120   symfony generate:project second 
     121   symfony generate:app frontend 
     122    
     123}}} 
     124   
     125 
     126Modify your {{{/etc/hosts}}}: 
     127 
     128{{{ 
     129    127.0.0.4   first.sym 
     130    127.0.0.4   second.sym 
     131}}}  
     132 
     133 
     134Point your browser to: 
     135 
     136  * http://first.sym/ 
     137  * http://second.sym/ 
     138   
     139  
     140This configuration is not a replacement for the solution described above. They perfectly live side-by-side. 
     141I use the ''one-config-for-all-setup'' for quick setups, e.g. testing of new plugins in a clean environment and the ''one-config-per-host-setup'' if I need special configuration settings. 
     142 
     143 
     144 
     145 
     146 
    50147'''DONE'''