How to be a CMS ASP-Hoster with Flux CMS

How to be a CMS ASP-Hoster with Flux CMS

The install directory should now contain all you need. It will be some handwork (mainly adjusting passwords and maybe locations) and if you don't have shell access and access to the httpd.conf files even more. But mass hosting would still be possible without those posssibilities. Just more work. If that's the case, look at the scripts and it should be somehow clear, what has to be done. If not, just ask (I actually didn't test these instructions, so they may be errors in there)

httpd.conf

  • Make your Apache config for all your domains, so they both point to
    the same directory

ServerName one.com
ServerAlias two.com
ServerAlias *.cmshoster.com

directory layout

  • [Install Flux CMS] with the installer, and then do the following

mkdir hosts/ #in BX PROJECT_DIR

config files

copy everything from install/conf-shared/ to conf/

cp install/conf-shared/* conf/

adjust the mysql parameters in config.xml:

vi conf/config.xml

The adjustments are for the "global access", not for one single-installation. All hosts are later running under the same mysql-user. So the tableprefix-parameter is not being used but gets fetched from the master-table (see below).

<db type="dsn">
        <phptype>mysql</phptype>
        <username>foo</username>
        <password>bar</password>
        <hostspec>localhost</hostspec>
        <database>schnickschnack</database> 
        <tableprefix>bxcms_</tableprefix>
    </db>

To have immediate success later, comment out the whole block "<permm type="permm">"

Now do the following:

cp install/properties-shared.xml-dist install/properties-shared.xml
vi install/properties-shared.xml

The important parameters are:

<property name="database.name" value="schnickschnack">Name of the database for the cms</property>
    <property name="database.user" value="foo">Name of the database user</property>
    <property name="database.password" value="bar">Password of the database user </property>

If you want to create new databases "on the fly", you also have to set the root-parameters, else, you have to comment them out!

.htaccess

mv .htaccess .htaccess-dist
 cp install/conf-shared/_htaccess_shared .htaccess

and make adjustements, if it needs them

RewriteMap

We also use RewriteMap from mod_rewrite. See
http://blog.var.cc/blog/archive/virtual_hosts_with_mod_rewrite.html for some overview.

I added the following to our .htaccess:

RewriteCond %{REQUEST_URI}  /*files/
RewriteCond ${lc:%{HTTP_HOST}|NONE} ^(.+)$
RewriteCond ${hostdir:%1} ^(.*)$
RewriteRule ^/*files/(.+)$  ./%1/files/$1 [L]

The Map hostdir contains the following:

one.com hosts/one/
two.com hosts/two/

(this file is automatically created with the installer explained below)

and the RewriteMap definition go into httpd.conf in the VirtualHost directives (they can't be put into .htaccess):

RewriteMap hostdir txt:/www-data/kunden/bitflux/free/cms/conf/rewrite_hosts.map
RewriteMap lc int:tolower

The Master-DB

in /install there is a sql-dump called "master.sql". Create a database called freeflux_master and use the dump to create the table in there:

mysql freeflux_master < ./install/master.sql

Using the installer

In install/, there's a file called "installAll.sh" which should be used to install all hosts in the pipeline.

The "master" table is per default in a separate database freeflux_master, you have to change the scripts, if you want to use something else for that.

The "pipeline" is an SQL table called "master", the sql dump can be found in install/master.sql.

The important fields are:

  • host: The hostname.
  • db: The database. you can put all hosts into one db or use different ones, they should just all be accessible by the same mysql-user.
  • prefix: the table prefix is in the standard bxcms installation. If you use one db for more than one host, you have to use different prefixes here
  • active: If it's active or not, 0 means to be installed, 1 is installed, 2 is inactive/closed
  • email: The adress the installation mail is sent to. This mail is important, it contains the password.
  • hostsdir: Where the directory for this host is. something like hosts/example_org/. different for each.

Then call "installAll.sh" and all new instances not yet installed are to be installed. The install script then copies the necessary files to hosts/domainname_org/ and does the needed tables.

To be able to use the installer as it is, also create a file ~/.my.cnf which containes something like this:

[client]
user         = foo
password     = bar

Further adjustments

  • The mail which is sent can be adjusted in ~/install/index-shared.php
  • Be sure the LogFormat in your httpd.conf contains the %V-parameter ("UseCanonicalName" has to be Off in order to work properly with ServerAlias)
  • you can split the main logfile with the split-logfile
  • installed themes get copied from the ~/themes-Folder
  • adjustments to the installation are done in the "makefile" ~/install/build-shared.xml

Documentation Todo's

  • Explanation of different params in the db (e.g. webalizer, ads) and how to use them
  • add some more basic-stuff

Labels:

Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.
  1. Oct 14, 2007

    Anonymous says:

    if you want to use the mdb2 mysqlidriver instead of the "regular" one, change in...

    if you want to use the mdb2 mysqli-driver instead of the "regular" one, change in config.xml to '<phptype>mysqli</phptype>' and in conf/after.php the line mysql_select_db($row['db']) to $db->database_name =$row['db'];

Add Comment

These projects are supported by Liip AG