Table of Contents

Multiblog Installation

Note:

These methods were sent by users and are not official documentation. They appear in the order of receipt.

Note:

Settings which are unset (blank) for individual blogs automatically inherit their values from the global defaults (see the about:config plugin).

FIXME draft

Method 1: one directory per blog

Objective : two blogs on a single installation :

There are several ways to create several blogs from the same installation. The following was largely inspired by Pasteur's post on the French forum. This method is easy to understand and isolates the themes and public directories of each blog.

Warning:

The blog ID is strictly the name of the directory. It is also the last segment of the blog URL. This instruction should absolutely be followed: Blog ID = name of the blog's directory = last segment of the blog URL.

The process that is described here is for an installation supporting PATH_INFO. If your installation uses query_string, simply follow this tutorial but replace the final slash with a question mark in URLs.

To avoid useless complexity, I did not try to remove index.php from the addresses.

Step 1: Installing Dotclear

Install Dotclear on your web space, carefully following the documentation. For simplicity we well assume that Dotclear's installation directory is dc2.

Step 2 : Creating one directory per blog

At the root of your webspace (i.e. alongside dc2), create two directories (blog1 and blog2), then create two subdirectories (public and themes) and one index.php file in each of them.

Content of index.php for Pretty blog One

<?php
define('DC_BLOG_ID','blog1'); # Blog ID
require dirname(__FILE__).'/../dc2/inc/public/prepend.php';
?>

Content of index.php for Pretty blog Two

<?php
define('DC_BLOG_ID','blog2'); # identifiant du blog
require dirname(__FILE__).'/../dc2/inc/public/prepend.php';
?>

Remember to place a complete copy of the default theme in the themes directory of each blog.

Step 3 : creating the blogs

(Example is given for Pretty blog One. The process will be the same for each blog, simply replace "blog1" with the relevant Blog ID.)

Creation

From the sidebar of the administration interface, click on Blogs then on Crete a new blog and fill in the fields as follows:

Settings

For each of these newly created blogs, select it as active blog 1) and click on the about:config link in the sidebar. You need to edit four fields:

Step 4 : routing each blog

When you have completed the first three steps, there is only one left: go to the application directory (dc2), rename index.php to orig-index.php 2) then create the following index.php file:

<?php
# ***** BEGIN LICENSE BLOCK *****
# This file is part of DotClear.
# Copyright (c) 2005 Olivier Meunier and contributors. All rights
# reserved.
#
# DotClear is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# 
# DotClear is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with DotClear; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# ***** END LICENSE BLOCK *****

if (isset($_SERVER['DC_BLOG_ID'])) {
	define('DC_BLOG_ID',$_SERVER['DC_BLOG_ID']);
} elseif (isset($_SERVER['REDIRECT_DC_BLOG_ID'])) {
	define('DC_BLOG_ID',$_SERVER['REDIRECT_DC_BLOG_ID']);
} elseif (isset($_SERVER['REDIRECT_REDIRECT_DC_BLOG_ID'])) {
	define('DC_BLOG_ID',$_SERVER['REDIRECT_REDIRECT_DC_BLOG_ID']);
}else {
	# Define your blog here
	define('DC_BLOG_ID','default');
}
require dirname(__FILE__).'/inc/public/prepend.php';
?>

You're done. Every blog has been created and they all have their own URL and files.

(Sent by Kozlika - kozlika at free.fr - 13/01/2007)


Step 1: Install Dotclear normally, and make sure it works (both visiting default site and logged-in site admin).

Step 2: Create a virtual host configuration file for each site (/etc/httpd/conf.d/SITE1.conf, /etc/httpd/conf.d/SITE2.conf, etc.). Make sure the DocumentRoot exists and is accessible (although you might get an error because there's no content yet). Customize each virtual host .conf file with its own DC_BLOG_ID, as in SetEnv DC_BLOG_ID SITE1.

Step 3: In each DocumentRoot directory, make index.php a symbolic link back to the master index.php in the main Dotclear site.

Step 4: For each virtual host, rewrite all URLs to Dotclear. The details depend on the blog's "URL scan method" and where you put the rules – see the <a href="http://httpd.apache.org/docs/2.4/mod/mod_rewrite.html#rewriterule">mod_rewrite</a> docs for details. QUERY_STRING is more efficient, because it avoids multiple failed queries before the correct path is requested and served (see <https://forum.dotclear.org/viewtopic.php?pid=315825#p315825> for details).

Step 4a: If using QUERY_STRING, put a redirect block like this into each blog's virtualhost .conf file:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/(.*)$ /index.php?$1

Step 4b: If using PATH_INFO you can put something like this in each blog's virtualhost .conf file:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /index.php/$1
RewriteRule ^/index.php$ /index.php/

Method 3: one virtual host per blog; all admin via SSL

FIXME This no longer worked for me in httpd 2.4 as of June 2016.

Objective: A single secure installation of Dotclear, using SSL to protect all authentication, and multiple blogs – each with its own domain name, but sharing the same user account database:

Note:

Thanks to Olivier for providing the original instructions from which I distilled these.

Submitted by Pepper, November 2008

These instructions describe how to set up a centrally managed server, hosting multiple blogs, each with its own domain name. For simplicity, user accounts and themes are shared, but each blog has its own 'owner' user account and configuration. The whole installation is managed by one Super-Admin. For security, all logins are through a single SSL virtual host, which may also serve non-Dotclear services, such as webmail.

Step 0: Install Dotclear 2 normally

My hostname is www, and my Apache DocumentRoot is /var/www/html, so I installed in /var/www/html/dotclear2. This made Dotclear available at http://www/dotclear2/.

Warning:

Set up PATH_INFO if desired, and make sure Dotclear works before proceeding. Note that if you uncomment the 4 PATH_INFO lines in inc/config.php, you might need to re-comment them later!

For our purposes, there are 4 types of files in Dotclear:

  1. public file, which must be accessible at each blog's URL: index.php
  2. common files, which must be accessible to every visitor, but can be common across blogs: themes & inc/public
  3. admin files, which should only be accessible to administrators: admin
  4. other files, which need to be accessible to PHP running on the web server, but need not be directly accessible to web browsers at all (plugins, locales, cache, etc.).

Dotclear expects the web server user (typically apache) to have write access to create inc/config.php and install plug-ins & themes. You can set this (from the dotclear2 directory) with a command such as:

mkdir cache
chown apache cache inc plugins themes
chmod g+w plugins themes # so I can install plugins such as daInstaller directly, too.

Now we can proceed to multiblog customization.

Step 1: Use Shared Paths for Common Resources

Go to the global options tab under PLUGINS:about:config. Specify full URL paths (starting with http) for theme_path and public_path – mine are http://www/dotclear2/inc/public & http://www/dotclear2/inc/public, but using full domain names. For your blog or blogs, and make sure theme_path and public_path are set the same way

Warning:

Individual blogs should really have these two fields left blank, so they inherit form the global settings, but this does not work correctly as of 2008/11/30.

Step 2: Set up Virtual Hosts

For each blog, create a virtual host configuration (if using http://httpd.apache.org/docs and NameVirtualHosts, don't forget to create a default virtual host). Aside from ServerName, Apache VirtualHost blocks only need to include directives that are different than the server defaults. Mine look like this:

[root@mmm conf.d]# cat ep.extrappeperoni.com.conf 
<VirtualHost *:80>

	ServerName ep.rep.dom
	ServerAlias ep.extrapepperoni.com ep
	CustomLog "|/usr/local/sbin/cronolog /var/log/httpd/%Y/ep.rep.dom-%Y-%m-access_log" combined
	SetEnv DC_BLOG_ID ExtraPepperoni

	DocumentRoot /var/empty/empty

	Alias /dotclear /var/www/html/dotclear2
	<Directory /var/www/html/dotclear2>
		Options FollowSymLinks MultiViews
	</Directory>

	Action dotclear /dotclear/index.php virtual
	<Location />
		SetHandler dotclear
	</Location>
	<Location /dotclear>
		SetHandler None
	</Location>

</VirtualHost>

If you can't use SetEnv, you should be able to accomplish something equivalent with mod_rewrite and a customized copy of index.php for each blog.

If name-based virtual hosts weren't already enabled, you may need to uncomment NameVirtualHost *:80 or the equivalent in httpd.conf (/etc/httpd/conf/httpd.conf on my system).

Don't forget to reload to pick up your changes – I use:

apachectl graceful

When done, your virtual host should show a Dotclear blog (assuming you set DC_BLOG_ID to your Blog ID.

In the admin interface, update SYSTEM:Blogs:Blog URL to the URL users will use to access the home page of this blog.

FIXME What's the default Blog ID? default??

Repeat this step to add more blogs.

Step 3: Move ''dotclear2'' out of ''DocumentRoot''

For security reasons, only index.php, public, and themes should be accessible via HTTP. Move the dotclear2 directory out of the DocumentRoot:

cd /var/www/html/ && mv dotclear2/ ..

Then recreate the directory that you just moved away, and create 3 symlinks for the content that needs to be served publicly:

ln -s ../../dotclear2/index.php && ln -s ../../dotclear2/inc && ln -s ../../dotclear2/themes
[root@mmm html]# ls -l dotclear2/
total 4
-rwxr--r-- 1 root root 70 Dec  7 17:10 favicon.ico
lrwxrwxrwx 1 root root 19 Dec  1 18:17 inc -> ../../dotclear2/inc
lrwxrwxrwx 1 root root 25 Nov 24 11:05 index.php -> ../../dotclear2/index.php
lrwxrwxrwx 1 root root 22 Nov 24 11:05 themes -> ../../dotclear2/themes

At this point, your blog should be accessible again, but not the admin interface.

Warning:

Note that if you uncommented the 4 PATH_INFO lines in inc/config.php, you might need to re-comment them now!

Step 4: Make the Admin Accessible via SSL

Set up SSL if you haven't already. Details are beyond the scope of this document, but some information on managing certificates is available at http://www.reppep.com/~pepper/writing/tidbits/ssl-article/. Note that SSL does not work properly with name-based virtual hosting, which is a reason blogs virtual hosts often are not accessible with SSL.

I added a single line to the end of /etc/httpd/conf.d/ssl.conf (before the closing </VirtualHost>):

Alias /dotclear /var/www/dotclear2/admin

  1. http://www/dotclear2/ – This serves themes & public, and an unusable index.php.
  2. https://www/dotclear/ – This serves Dotclear's administrative interface – each admin will need to bookmark this, or you must manually add a link to it for them to follow.

Warning:

If you are trying to configure Dotclear for the first time, note that the wizard may take you to admin/install/ when you really want just install/, because admin/ is already part of the Alias directive.

Step 5: Configure Dotclear for Higher Security

In inc/config.php, set the ADMIN_URL, and make cookies SSL-only:

// Admin URL. You need to set it for some features.
define('DC_ADMIN_URL','https://www/dotclear/');

// Require SSL for admin
define('DC_ADMIN_SSL',true);
1) Select the active blog from the drop-down menu located in the top right corner of the administration interface.
2) Renaming the file provides a backup of the original file in case of trouble.