On Thursday 28 May 2009 10:23:57 Eugen_cro wrote:
> Jurian Sluiman wrote:
> > Hi Eugen,
> > I have had the same thoughts about this subject. For me, I'd like to have
> > one
> > cms to control multiple websites at the same time, but the implementation
> > is
> > almost the same as yours.
> >
> > You need for each different website a different public folder to store
> > the styles, scripts and images. I think you should remove the
> > application.ini from
> > you application directory and put it in the public dir of the specific
> > website, but it involves a big security issue (an ini file is for sure
> > readable by a webbrowser).
> > You could change it into a php array, but this is still not the best
> > option
> > (you just placed the whole application out of your webroot). The other
> > option
> > is to make the application.ini not readable by others except for www-data
> > (your apache user).
> >
> > The last option (and I think it's the best one) is to rename the
> > application.ini to yourwebsitename.ini and put all the different configs
> > in
> > application/config. In the public/index.php you could set a constant
> > containing the name of the website (just like APPLICATION_PATH and
> > APPLICATION_ENV).
> >
> > If there are more options, please let me know.
> > Regards, Jurian
> > --
> > Jurian Sluiman
> > Soflomo.com
>
> The automated cms will probably come with time, but for now this is one of
> mayor issues..
> The application(domain).ini was one of the idea, even loading multiple
> configs (one shared, and one site specific)..

You could have the usual layout with the addition of sites/ in root dir. So 
you can have

sites/
    siteA/
        public/
        application.ini
    siteB/
        public/
        application.ini

You can still have the basic application.ini file which you extend at deploy 
time, say you append

[siteA : production]
resources.db.params.dbname = "siteA"

to the content of application.ini (but don't overwrite it) and copy all of 
that to sites/siteA/application.ini. So, when you change your generic 
application.ini, you recreate site-specific copies from that, a one-liner 
shell script could do that for you.

Now, only thing left is to create one virtual host per site

<VirtualHost X.X.X.X>
    SetEnv APPLICATION_ENV siteA
    DocumentRoot /full/path/to/your/app/sites/siteA/public
    ServerName siteA.foo
    ServerAlias www.siteA.foo
</VirtualHost>

<VirtualHost X.X.X.X>
    SetEnv APPLICATION_ENV siteB
    DocumentRoot /full/path/to/your/app/sites/siteB/public
    ServerName siteB.foo
    ServerAlias www.siteB.foo
</VirtualHost>

Apache has a dynamically configured vhost ability[1] so you could simplify 
adding a new site to the "pool" even more.

That should give you a good starting point, HTH. :)

[1] http://httpd.apache.org/docs/2.0/vhosts/mass.html

-- 
Dado

Reply via email to